開発者ツール
MongoDBガイド
開発データ、コード、検索作業に使えるブラウザツールです。
| カテゴリ | コマンド | 説明 | |
|---|---|---|---|
| Connection | mongosh | Connect to a local MongoDB server. | |
| Connection | mongosh "mongodb://localhost:27017/app_db" | Connect to a specific database with a connection string. | |
| Database | show dbs | List databases. | |
| Database | use app_db | Switch to a database. It is created when data is inserted. | |
| Collection | show collections | List collections in the current database. | |
| Collection | db.createCollection("users") | Create a collection explicitly. | |
| Insert | db.users.insertOne({ email: "demo@example.com", createdAt: new Date() }) | Insert one document. | |
| Insert | db.users.insertMany([{ email: "a@example.com" }, { email: "b@example.com" }]) | Insert multiple documents. | |
| Read | db.users.find({ email: /@example.com$/ }).sort({ createdAt: -1 }).limit(20) | Query, sort, and limit documents. | |
| Read | db.users.findOne({ email: "demo@example.com" }) | Find a single matching document. | |
| Update | db.users.updateOne({ email: "demo@example.com" }, { $set: { active: true } }) | Update one matching document. | |
| Update | db.users.updateMany({ active: { $exists: false } }, { $set: { active: true } }) | Update many matching documents. | |
| Delete | db.users.deleteOne({ email: "demo@example.com" }) | Delete one matching document. | |
| Delete | db.users.deleteMany({ active: false }) | Delete many matching documents. | |
| Index | db.users.createIndex({ email: 1 }, { unique: true }) | Create a unique ascending index. | |
| Index | db.users.getIndexes() | List collection indexes. | |
| Aggregation | db.orders.aggregate([{ $group: { _id: "$userId", total: { $sum: "$total" } } }]) | Group documents and compute totals. | |
| Count | db.users.countDocuments({ active: true }) | Count matching documents. | |
| Backup | mongodump --db app_db --out ./backup | Export a database backup. | |
| Restore | mongorestore --db app_db ./backup/app_db | Restore a dumped database. |
概念
MongoDBの基本
| 概念 | 意味 |
|---|---|
| Document | A JSON-like BSON object stored in a collection. |
| Collection | A group of documents, roughly comparable to a table but schema-flexible. |
| Database | A namespace containing collections and indexes. |
| ObjectId | The common default value for the _id primary key. |
| Index | A data structure that speeds up reads and supports uniqueness constraints. |
| Aggregation | A pipeline for transforming, grouping, filtering, and joining document data. |
ツールガイド
使い方: MongoDBガイド
概要
開発データ、コード、検索作業に使えるブラウザツールです。 結果を使用する前に確認するための、簡単な手順を説明します。
手順
- MongoDBガイド を開き、処理する入力データのコピーを準備します。
- ツールで求められるファイル、テキスト、または値を入力します。
- 目的に合う設定を選び、処理を開始します。
- コピー、ダウンロード、共有の前に結果を確認します。
例
まず短い機密性のない例で結果を確認してから、最終的なコンテンツで同じ操作を行ってください。
結果を使用する前に
- NovaKit のツールはブラウザ内での利用を想定しています。処理する権限のあるデータだけを使用してください。
- 元のデータを保持し、重要な結果は意思決定や最終文書に使う前に確認してください。
FAQ
よくある質問
MongoDBガイド: 結果はどのように確認しますか?
開発データ、コード、検索作業に使えるブラウザツールです。
MongoDBガイド: 結果はどのように確認しますか?
MongoDBガイド を開き、処理する入力データのコピーを準備します。 ツールで求められるファイル、テキスト、または値を入力します。 目的に合う設定を選び、処理を開始します。 コピー、ダウンロード、共有の前に結果を確認します。
結果はどのように確認しますか?
使用前に出力を読み直し、プレビューまたはテストしてください。
アカウントの作成は必要ですか?
いいえ。NovaKit のツールはアカウントなしで直接使用できます。
データはどのように扱われますか?
NovaKit のツールはブラウザ内での利用を想定しています。処理する権限のあるデータだけを使用してください。
注意すべき点はありますか?
元のデータを保持し、重要な結果は意思決定や最終文書に使う前に確認してください。
MongoDBガイド にはどのような例を使えますか?
まず短い機密性のない例で結果を確認してから、最終的なコンテンツで同じ操作を行ってください。
結果のコピーを保存できますか?
利用できるコピー、ダウンロード、印刷、エクスポート機能を使い、確認が終わるまで元の入力を保持してください。
関連ツール