MongoDB
Read and write MongoDB collections with a configuration JSON: find, aggregate, insert rows, update, delete, indexes and GridFS files. Typical uses: read a MongoDB collection to feed a report, or write the results of a script back into MongoDB.
mongodb pingmongodb infomongodb collection_dropmongodb collection_createmongodb collection_createmongodb collectionsmongodb insertmongodb insertmongodb databasesmongodb findmongodb findmongodb findmongodb getmongodb putmongodb updatemongodb updatemongodb countmongodb countmongodb distinctmongodb distinctmongodb aggregatemongodb aggregatemongodb bulkmongodb bulkmongodb deletemongodb delete_wheremongodb index_createmongodb index_createmongodb indexesmongodb index_dropmongodb collection_infomongodb commandmongodb file_putmongodb file_putmongodb filesmongodb filesmongodb file_getmongodb file_delete
mongodb ping <json_config>
Description
A quick test of the connection: {ok, version}
A quick test of the connection: {ok, version}
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
admin
mongodb ping "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}"
mentdb
{"ok": true, "version": "8.0.16"}
a user and a password read from an secret (fixed result: real MongoDB 8.0.16)
admin
mongodb ping "{\"host\": \"127.0.0.1\", \"database\": \"shop\", \"username\": \"app\", \"password\": \"mongo_password\"}"
mentdb
{"ok": true, "version": "8.0.16"}
mongodb info <json_config>
Description
The server: version, maximum document size, wire version, primary, replica set name and hosts
The server: version, maximum document size, wire version, primary, replica set name and hosts
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
admin
mongodb info "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}"
mentdb
{"version": "8.0.16", "git_version": "ba70b6a13fda907977110bf46e6c8137f5de48f6", "max_bson_size": 16777216, "max_wire_version": 25, "primary": true, "set_name": null, "hosts": null, "read_only": false}
mongodb collection_drop <json_config> <collection>
Description
Drop a collection and its indexes. Returns {dropped, existed}
Drop a collection and its indexes. Returns {dropped, existed}
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
admin
mongodb collection_drop "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders"
mentdb
{"dropped": "orders", "existed": false}
mongodb collection_create <json_config> <collection>
Description
Create a collection explicitly (a first insert also creates it). Returns {created}
Create a collection explicitly (a first insert also creates it). Returns {created}
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
admin
mongodb collection_create "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders"
mentdb
{"created": "orders"}
mongodb collection_create <json_config> <collection> <json_options>
Description
Create a collection with options: capped (with size in bytes and max documents), validator (with validation_level and validation_action), or a time series (time_field, meta_field, granularity seconds|minutes|hours, expire_after_seconds)
Create a collection with options: capped (with size in bytes and max documents), validator (with validation_level and validation_action), or a time series (time_field, meta_field, granularity seconds|minutes|hours, expire_after_seconds)
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_options: The options as a JSON object - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_options: The options as a JSON object - String - required
admin
mongodb collection_create "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "measures" "{\"time_field\": \"ts\", \"meta_field\": \"sensor\", \"granularity\": \"minutes\"}"
mentdb
{"created": "measures"}
a collection with a JSON schema validator (fixed result: real MongoDB 8.0.16)
admin
mongodb collection_create "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "clients" "{\"validator\": {\"$jsonSchema\": {\"required\": [\"name\", \"email\"], \"properties\": {\"email\": {\"bsonType\": \"string\", \"pattern\": \"@\"}}}}}"
mentdb
{"created": "clients"}
mongodb collections <json_config>
Description
The collection names of the database, sorted
The collection names of the database, sorted
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
admin
mongodb collections "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}"
mentdb
["clients", "measures", "orders"]
Often used with
json doc · json parse_array · mongodb collection_info · mongodb delete_where · mongodb find · mongodb put · mongodb update · parameter get value
json doc · json parse_array · mongodb collection_info · mongodb delete_where · mongodb find · mongodb put · mongodb update · parameter get value
mongodb insert <json_config> <collection> <json_rows>
Description
Insert MQL rows (a JSON array of objects) in one round trip. Returns {inserted, ids, errors}: the ids given or created (ObjectId as text); ids is left out when a row fails (errors gives the index of each failed row)
Insert MQL rows (a JSON array of objects) in one round trip. Returns {inserted, ids, errors}: the ids given or created (ObjectId as text); ids is left out when a row fails (errors gives the index of each failed row)
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_rows: The documents as a JSON array of objects (MQL rows) - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_rows: The documents as a JSON array of objects (MQL rows) - String - required
admin
mongodb insert "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "[{\"_id\": \"A1\", \"client\": \"Zoé\", \"city\": \"Paris\", \"amount\": 120.5, \"items\": [\"pen\", \"book\"], \"date\": {\"$date\": \"2026-11-02T10:00:00Z\"}}, {\"_id\": \"A2\", \"client\": \"Max\", \"city\": \"Lyon\", \"amount\": 40}, {\"_id\": \"A3\", \"client\": \"Ana\", \"city\": \"Paris\", \"amount\": 75}]"
mentdb
{"inserted": 3, "ids": ["A1", "A2", "A3"], "errors": []}
a document without _id: MongoDB creates an ObjectId (fixed result: real MongoDB 8.0.16)
admin
mongodb insert "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "[{\"client\": \"Lou\", \"city\": \"Nice\", \"amount\": 12}]"
mentdb
{"inserted": 1, "ids": ["6afc3b5b409bbfc231dec5cd"], "errors": []}
mongodb insert <json_config> <collection> <json_rows> <json_options>
Description
Insert rows with options: ordered (true: stop at the first error; false: insert all the valid rows), id_field (the column used as _id)
Insert rows with options: ordered (true: stop at the first error; false: insert all the valid rows), id_field (the column used as _id)
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_rows: The documents as a JSON array of objects (MQL rows) - String - required
json_options: The options as a JSON object - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_rows: The documents as a JSON array of objects (MQL rows) - String - required
json_options: The options as a JSON object - String - required
admin
mongodb insert "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "[{\"_id\": \"A1\", \"client\": \"dup\"}, {\"_id\": \"A4\", \"client\": \"Eva\", \"city\": \"Lyon\", \"amount\": 60}]" "{\"ordered\": false}"
mentdb
{"inserted": 1, "errors": [{"index": 0, "code": 11000, "message": "E11000 duplicate key error collection: shop.orders index: _id_ dup key: { _id: \"A1\" }"}]}
the column "code" becomes the _id (fixed result: real MongoDB 8.0.16)
admin
mongodb insert "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "products" "[{\"code\": \"P1\", \"name\": \"pen\", \"price\": 1.5}, {\"code\": \"P2\", \"name\": \"book\", \"price\": 12}]" "{\"id_field\": \"code\"}"
mentdb
{"inserted": 2, "ids": ["P1", "P2"], "errors": []}
mongodb databases <json_config>
Description
The names of the databases the user can see
The names of the databases the user can see
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
admin
mongodb databases "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}"
mentdb
["shop"]
mongodb find <json_config> <collection>
Description
All the documents of a collection, as rows (10000 at most: use the options for more; a result is limited to 256 MB)
All the documents of a collection, as rows (10000 at most: use the options for more; a result is limited to 256 MB)
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
admin
mongodb find "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "products"
mentdb
[{"_id": "P1", "name": "pen", "price": 1.5}, {"_id": "P2", "name": "book", "price": 12}]
mongodb find <json_config> <collection> <json_filter>
Description
The documents that match a filter, as rows. ObjectId become text, dates ISO 8601 UTC text
The documents that match a filter, as rows. ObjectId become text, dates ISO 8601 UTC text
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_filter: The filter, a MongoDB query object ({} for all). Extended JSON is accepted: {"$oid": ...}, {"$date": ...} - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_filter: The filter, a MongoDB query object ({} for all). Extended JSON is accepted: {"$oid": ...}, {"$date": ...} - String - required
admin
mongodb find "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "{\"city\": \"Paris\"}"
mentdb
[{"_id": "A1", "client": "Zoé", "city": "Paris", "amount": 120.5, "items": ["pen", "book"], "date": "2026-11-02T10:00:00Z"}, {"_id": "A3", "client": "Ana", "city": "Paris", "amount": 75}]
an operator (fixed result: real MongoDB 8.0.16)
admin
mongodb find "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "{\"amount\": {\"$gte\": 60}, \"city\": {\"$in\": [\"Paris\", \"Lyon\"]}}"
mentdb
[{"_id": "A1", "client": "Zoé", "city": "Paris", "amount": 120.5, "items": ["pen", "book"], "date": "2026-11-02T10:00:00Z"}, {"_id": "A3", "client": "Ana", "city": "Paris", "amount": 75}, {"_id": "A4", "client": "Eva", "city": "Lyon", "amount": 60}]
mongodb find <json_config> <collection> <json_filter> <json_options>
Description
Find with options: limit (10000, at most 1000000), skip, sort, fields (a list of fields or a projection object), hint, max_time_ms (120000), batch_size, extended (true: MongoDB Extended JSON, keeps the types)
Find with options: limit (10000, at most 1000000), skip, sort, fields (a list of fields or a projection object), hint, max_time_ms (120000), batch_size, extended (true: MongoDB Extended JSON, keeps the types)
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_filter: The filter, a MongoDB query object ({} for all). Extended JSON is accepted: {"$oid": ...}, {"$date": ...} - String - required
json_options: The options as a JSON object - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_filter: The filter, a MongoDB query object ({} for all). Extended JSON is accepted: {"$oid": ...}, {"$date": ...} - String - required
json_options: The options as a JSON object - String - required
admin
mongodb find "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "{}" "{\"sort\": {\"amount\": -1}, \"limit\": 2, \"fields\": [\"client\", \"amount\"]}"
mentdb
[{"_id": "A1", "client": "Zoé", "amount": 120.5}, {"_id": "A3", "client": "Ana", "amount": 75}]
the types kept (extended JSON) (fixed result: real MongoDB 8.0.16)
admin
mongodb find "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "{\"_id\": \"A1\"}" "{\"extended\": true}"
mentdb
[{"_id": "A1", "client": "Zoé", "city": "Paris", "amount": 120.5, "items": ["pen", "book"], "date": {"$date": "2026-11-02T10:00:00Z"}}]
Often used with
json doc · json parse_array · mongodb collection_info · mongodb collections · mongodb delete_where · mongodb put · mongodb update · parameter get value
json doc · json parse_array · mongodb collection_info · mongodb collections · mongodb delete_where · mongodb put · mongodb update · parameter get value
mongodb get <json_config> <collection> <id>
Description
One document by its _id, or null
One document by its _id, or null
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
id: The _id of the document, as text. A text _id is looked for first; when there is none, 24 hex digits also match an ObjectId and an integer text without leading zero a number - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
id: The _id of the document, as text. A text _id is looked for first; when there is none, 24 hex digits also match an ObjectId and an integer text without leading zero a number - String - required
admin
mongodb get "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "A2"
mentdb
{"_id": "A2", "client": "Max", "city": "Lyon", "amount": 40}
no such document (fixed result: real MongoDB 8.0.16)
admin
mongodb get "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "Z9"
mentdb
null
mongodb put <json_config> <collection> <id> <json_document>
Description
Write a whole document under an _id: replaced if a document has this id (same rules as mongodb get), else created with this text as _id (an ObjectId for 24 hex digits). Returns {id, created, modified}
Write a whole document under an _id: replaced if a document has this id (same rules as mongodb get), else created with this text as _id (an ObjectId for 24 hex digits). Returns {id, created, modified}
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
id: The _id of the document, as text. A text _id is looked for first; when there is none, 24 hex digits also match an ObjectId and an integer text without leading zero a number - String - required
json_document: The document (a JSON object) - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
id: The _id of the document, as text. A text _id is looked for first; when there is none, 24 hex digits also match an ObjectId and an integer text without leading zero a number - String - required
json_document: The document (a JSON object) - String - required
admin
mongodb put "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "B7" "{\"client\": \"Lou\", \"city\": \"Nice\", \"amount\": 10}"
mentdb
{"id": "B7", "created": true, "modified": 0}
the same _id again: replaced (fixed result: real MongoDB 8.0.16)
admin
mongodb put "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "B7" "{\"client\": \"Lou\", \"city\": \"Nice\", \"amount\": 14}"
mentdb
{"id": "B7", "created": false, "modified": 1}
Often used with
json doc · json parse_array · mongodb collection_info · mongodb collections · mongodb delete_where · mongodb find · mongodb update · parameter get value
json doc · json parse_array · mongodb collection_info · mongodb collections · mongodb delete_where · mongodb find · mongodb update · parameter get value
mongodb update <json_config> <collection> <json_filter> <json_changes>
Description
Update the documents that match a filter. The changes are update operators ($set, $inc, $push...), plain fields (set as with $set) or an aggregation pipeline (a JSON array). Returns {matched, modified}. The filter is required: "{}" updates every document
Update the documents that match a filter. The changes are update operators ($set, $inc, $push...), plain fields (set as with $set) or an aggregation pipeline (a JSON array). Returns {matched, modified}. The filter is required: "{}" updates every document
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_filter: The filter, a MongoDB query object ({} for all). Extended JSON is accepted: {"$oid": ...}, {"$date": ...} - String - required
json_changes: The changes - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_filter: The filter, a MongoDB query object ({} for all). Extended JSON is accepted: {"$oid": ...}, {"$date": ...} - String - required
json_changes: The changes - String - required
admin
mongodb update "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "{\"_id\": \"A2\"}" "{\"amount\": 45, \"status\": \"paid\"}"
mentdb
{"matched": 1, "modified": 1}
an operator on every document of Paris (fixed result: real MongoDB 8.0.16)
admin
mongodb update "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "{\"city\": \"Paris\"}" "{\"$inc\": {\"amount\": 5}}"
mentdb
{"matched": 2, "modified": 2}
a pipeline: a field computed from another (fixed result: real MongoDB 8.0.16)
admin
mongodb update "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "{}" "[{\"$set\": {\"vat\": {\"$round\": [{\"$multiply\": [\"$amount\", 0.2]}, 2]}}}]"
mentdb
{"matched": 6, "modified": 6}
mongodb update <json_config> <collection> <json_filter> <json_changes> <json_options>
Description
Update with options: upsert (create when nothing matches; then upserted_id is given), one (only the first match), array_filters
Update with options: upsert (create when nothing matches; then upserted_id is given), one (only the first match), array_filters
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_filter: The filter, a MongoDB query object ({} for all). Extended JSON is accepted: {"$oid": ...}, {"$date": ...} - String - required
json_changes: The changes - String - required
json_options: The options as a JSON object - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_filter: The filter, a MongoDB query object ({} for all). Extended JSON is accepted: {"$oid": ...}, {"$date": ...} - String - required
json_changes: The changes - String - required
json_options: The options as a JSON object - String - required
admin
mongodb update "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "counters" "{\"_id\": \"orders\"}" "{\"$inc\": {\"seq\": 1}}" "{\"upsert\": true}"
mentdb
{"matched": 0, "modified": 0, "upserted_id": "orders"}
the first match only (fixed result: real MongoDB 8.0.16)
admin
mongodb update "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "{\"city\": \"Lyon\"}" "{\"$set\": {\"checked\": true}}" "{\"one\": true}"
mentdb
{"matched": 1, "modified": 1}
Often used with
json doc · json parse_array · mongodb collection_info · mongodb collections · mongodb delete_where · mongodb find · mongodb put · parameter get value
json doc · json parse_array · mongodb collection_info · mongodb collections · mongodb delete_where · mongodb find · mongodb put · parameter get value
mongodb count <json_config> <collection>
Description
The number of documents of a collection
The number of documents of a collection
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
admin
mongodb count "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders"
mentdb
6
mongodb count <json_config> <collection> <json_filter>
Description
The number of documents that match a filter
The number of documents that match a filter
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_filter: The filter, a MongoDB query object ({} for all). Extended JSON is accepted: {"$oid": ...}, {"$date": ...} - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_filter: The filter, a MongoDB query object ({} for all). Extended JSON is accepted: {"$oid": ...}, {"$date": ...} - String - required
admin
mongodb count "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "{\"amount\": {\"$gte\": 50}}"
mentdb
3
mongodb distinct <json_config> <collection> <field>
Description
The distinct values of a field (inside arrays too)
The distinct values of a field (inside arrays too)
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
field: The field (a.b for a sub field) - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
field: The field (a.b for a sub field) - String - required
admin
mongodb distinct "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "city"
mentdb
["Lyon", "Nice", "Paris"]
mongodb distinct <json_config> <collection> <field> <json_filter>
Description
The distinct values of a field among the documents that match a filter
The distinct values of a field among the documents that match a filter
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
field: The field - String - required
json_filter: The filter, a MongoDB query object ({} for all). Extended JSON is accepted: {"$oid": ...}, {"$date": ...} - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
field: The field - String - required
json_filter: The filter, a MongoDB query object ({} for all). Extended JSON is accepted: {"$oid": ...}, {"$date": ...} - String - required
admin
mongodb distinct "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "client" "{\"city\": \"Paris\"}"
mentdb
["Ana", "Zoé"]
mongodb aggregate <json_config> <collection> <json_pipeline>
Description
Run an aggregation pipeline: the result documents as rows. A pipeline that ends with $out or $merge writes into a collection and returns []
Run an aggregation pipeline: the result documents as rows. A pipeline that ends with $out or $merge writes into a collection and returns []
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_pipeline: The pipeline, a JSON array of stages - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_pipeline: The pipeline, a JSON array of stages - String - required
admin
mongodb aggregate "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "[{\"$match\": {\"amount\": {\"$gt\": 0}}}, {\"$group\": {\"_id\": \"$city\", \"total\": {\"$sum\": \"$amount\"}, \"orders\": {\"$sum\": 1}}}, {\"$sort\": {\"total\": -1}}]"
mentdb
[{"_id": "Paris", "total": 205.5, "orders": 2}, {"_id": "Lyon", "total": 105, "orders": 2}, {"_id": "Nice", "total": 26, "orders": 2}]
a join with $lookup (fixed result: real MongoDB 8.0.16)
admin
mongodb aggregate "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "[{\"$match\": {\"_id\": \"A1\"}}, {\"$unwind\": \"$items\"}, {\"$lookup\": {\"from\": \"products\", \"localField\": \"items\", \"foreignField\": \"name\", \"as\": \"product\"}}, {\"$project\": {\"_id\": 0, \"item\": \"$items\", \"price\": {\"$first\": \"$product.price\"}}}]"
mentdb
[{"item": "pen", "price": 1.5}, {"item": "book", "price": 12}]
mongodb aggregate <json_config> <collection> <json_pipeline> <json_options>
Description
Aggregate with options: limit (10000), allow_disk_use, max_time_ms (120000), batch_size, extended
Aggregate with options: limit (10000), allow_disk_use, max_time_ms (120000), batch_size, extended
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_pipeline: The pipeline - String - required
json_options: The options as a JSON object - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_pipeline: The pipeline - String - required
json_options: The options as a JSON object - String - required
admin
mongodb aggregate "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "[{\"$group\": {\"_id\": \"$city\", \"n\": {\"$sum\": 1}}}, {\"$sort\": {\"_id\": 1}}]" "{\"limit\": 1}"
mentdb
[{"_id": "Lyon", "n": 2}]
mongodb bulk <json_config> <collection> <json_operations>
Description
Several writes in one round trip: a JSON array of {"insert": document}, {"update": {filter, changes, upsert, one}}, {"replace": {filter, document, upsert}}, {"delete": {filter, one}}. Returns {inserted, matched, modified, deleted, upserted, errors}
Several writes in one round trip: a JSON array of {"insert": document}, {"update": {filter, changes, upsert, one}}, {"replace": {filter, document, upsert}}, {"delete": {filter, one}}. Returns {inserted, matched, modified, deleted, upserted, errors}
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_operations: The operations - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_operations: The operations - String - required
admin
mongodb bulk "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "[{\"insert\": {\"_id\": \"C1\", \"client\": \"Bob\", \"city\": \"Nice\", \"amount\": 30}}, {\"update\": {\"filter\": {\"_id\": \"C1\"}, \"changes\": {\"amount\": 33}, \"one\": true}}, {\"delete\": {\"filter\": {\"_id\": \"B7\"}, \"one\": true}}]"
mentdb
{"inserted": 1, "matched": 1, "modified": 1, "deleted": 1, "upserted": 0, "errors": []}
mongodb bulk <json_config> <collection> <json_operations> <json_options>
Description
Bulk writes with options: ordered (true: stop at the first error)
Bulk writes with options: ordered (true: stop at the first error)
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_operations: The operations - String - required
json_options: The options as a JSON object - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_operations: The operations - String - required
json_options: The options as a JSON object - String - required
admin
mongodb bulk "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "[{\"insert\": {\"_id\": \"C1\"}}, {\"insert\": {\"_id\": \"C2\", \"client\": \"Kim\", \"city\": \"Lyon\", \"amount\": 8}}]" "{\"ordered\": false}"
mentdb
{"inserted": 1, "matched": 0, "modified": 0, "deleted": 0, "upserted": 0, "errors": [{"index": 0, "code": 11000, "message": "E11000 duplicate key error collection: shop.orders index: _id_ dup key: { _id: \"C1\" }"}]}
mongodb delete <json_config> <collection> <id>
Description
Delete one document by its _id. Returns {deleted}
Delete one document by its _id. Returns {deleted}
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
id: The _id of the document, as text. A text _id is looked for first; when there is none, 24 hex digits also match an ObjectId and an integer text without leading zero a number - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
id: The _id of the document, as text. A text _id is looked for first; when there is none, 24 hex digits also match an ObjectId and an integer text without leading zero a number - String - required
admin
mongodb delete "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "C2"
mentdb
{"deleted": 1}
mongodb delete_where <json_config> <collection> <json_filter>
Description
Delete the documents that match a filter ("{}" deletes every document). Returns {deleted}
Delete the documents that match a filter ("{}" deletes every document). Returns {deleted}
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_filter: The filter, a MongoDB query object ({} for all). Extended JSON is accepted: {"$oid": ...}, {"$date": ...} - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_filter: The filter, a MongoDB query object ({} for all). Extended JSON is accepted: {"$oid": ...}, {"$date": ...} - String - required
admin
mongodb delete_where "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "{\"amount\": {\"$lt\": 20}}"
mentdb
{"deleted": 1}
Often used with
json doc · json parse_array · mongodb collection_info · mongodb collections · mongodb find · mongodb put · mongodb update · parameter get value
json doc · json parse_array · mongodb collection_info · mongodb collections · mongodb find · mongodb put · mongodb update · parameter get value
mongodb index_create <json_config> <collection> <json_keys>
Description
Create an index. Returns {name}
Create an index. Returns {name}
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_keys: The keys: {"field": 1} ascending, -1 descending, "text", "2dsphere", "hashed" - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_keys: The keys: {"field": 1} ascending, -1 descending, "text", "2dsphere", "hashed" - String - required
admin
mongodb index_create "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "{\"city\": 1, \"amount\": -1}"
mentdb
{"name": "city_1_amount_-1"}
mongodb index_create <json_config> <collection> <json_keys> <json_options>
Description
Create an index with options: name, unique, sparse, expire_after_seconds (TTL index on a date field), partial_filter
Create an index with options: name, unique, sparse, expire_after_seconds (TTL index on a date field), partial_filter
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_keys: The keys - String - required
json_options: The options as a JSON object - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_keys: The keys - String - required
json_options: The options as a JSON object - String - required
admin
mongodb index_create "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "clients" "{\"email\": 1}" "{\"unique\": true, \"name\": \"email_unique\"}"
mentdb
{"name": "email_unique"}
documents deleted one hour after their date (fixed result: real MongoDB 8.0.16)
admin
mongodb index_create "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "sessions" "{\"created\": 1}" "{\"expire_after_seconds\": 3600}"
mentdb
{"name": "created_1"}
mongodb indexes <json_config> <collection>
Description
The indexes of a collection as rows: name, keys, unique, expire_after_seconds, partial_filter
The indexes of a collection as rows: name, keys, unique, expire_after_seconds, partial_filter
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
admin
mongodb indexes "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders"
mentdb
[{"name": "_id_", "keys": {"_id": 1}, "unique": false}, {"name": "city_1_amount_-1", "keys": {"city": 1, "amount": -1}, "unique": false}]
mongodb index_drop <json_config> <collection> <name>
Description
Drop an index by its name (not _id_). Returns {dropped}
Drop an index by its name (not _id_). Returns {dropped}
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
name: The index name - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
name: The index name - String - required
admin
mongodb index_drop "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders" "city_1_amount_-1"
mentdb
{"dropped": "city_1_amount_-1"}
mongodb collection_info <json_config> <collection>
Description
A collection: type (collection, view, timeseries), options, count, size, storage_size, avg_obj_size, total_index_size, indexes
A collection: type (collection, view, timeseries), options, count, size, storage_size, avg_obj_size, total_index_size, indexes
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
collection: The collection name - String - required
admin
mongodb collection_info "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "orders"
mentdb
{"name": "orders", "type": "collection", "options": {}, "count": 5, "size": 435, "storage_size": 4096, "avg_obj_size": 87, "total_index_size": 4096, "indexes": ["_id_"]}
Often used with
json doc · json parse_array · mongodb collections · mongodb delete_where · mongodb find · mongodb put · mongodb update · parameter get value
json doc · json parse_array · mongodb collections · mongodb delete_where · mongodb find · mongodb put · mongodb update · parameter get value
mongodb command <json_config> <json_command>
Description
Run a database command (runCommand) on the database of the config: the reply document
Run a database command (runCommand) on the database of the config: the reply document
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
json_command: The command, ex: {"dbStats": 1} - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
json_command: The command, ex: {"dbStats": 1} - String - required
admin
mongodb command "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "{\"count\": \"orders\", \"query\": {\"city\": \"Paris\"}}"
mentdb
{"n": 2, "ok": 1}
mongodb file_put <json_config> <bucket> <filename> <file_path>
Description
Store a local file in GridFS (files larger than 16 MB too, up to 2 GB). Returns {id, filename, size}
Store a local file in GridFS (files larger than 16 MB too, up to 2 GB). Returns {id, filename, size}
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
bucket: The GridFS bucket name (fs by default when empty) - String - required
filename: The name in GridFS - String - required
file_path: The local file - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
bucket: The GridFS bucket name (fs by default when empty) - String - required
filename: The name in GridFS - String - required
file_path: The local file - String - required
admin
mongodb file_put "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "reports" "sales.csv" "tmp/sales.csv"
mentdb
{"id": "6afc3b5b409bbfc231dec5ce", "filename": "sales.csv", "size": 39}
mongodb file_put <json_config> <bucket> <filename> <file_path> <json_metadata>
Description
Store a local file in GridFS with metadata (a JSON object)
Store a local file in GridFS with metadata (a JSON object)
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
bucket: The GridFS bucket name (fs by default when empty) - String - required
filename: The name in GridFS - String - required
file_path: The local file - String - required
json_metadata: The metadata - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
bucket: The GridFS bucket name (fs by default when empty) - String - required
filename: The name in GridFS - String - required
file_path: The local file - String - required
json_metadata: The metadata - String - required
admin
mongodb file_put "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "reports" "sales-2026.csv" "tmp/sales.csv" "{\"owner\": \"finance\", \"year\": 2026}"
mentdb
{"id": "6afc3b5b409bbfc231dec5d0", "filename": "sales-2026.csv", "size": 39}
mongodb files <json_config> <bucket>
Description
The files of a GridFS bucket as rows: id, filename, size, upload_date, metadata
The files of a GridFS bucket as rows: id, filename, size, upload_date, metadata
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
bucket: The GridFS bucket name (fs by default when empty) - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
bucket: The GridFS bucket name (fs by default when empty) - String - required
admin
mongodb files "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "reports"
mentdb
[{"id": "6afc3b5b409bbfc231dec5d0", "filename": "sales-2026.csv", "size": 39, "upload_date": "2026-11-17T11:32:43.751Z", "metadata": {"owner": "finance", "year": 2026}}, {"id": "6afc3b5b409bbfc231dec5ce", "filename": "sales.csv", "size": 39, "upload_date": "2026-11-17T11:32:43.748Z", "metadata": null}]
mongodb files <json_config> <bucket> <json_filter>
Description
The files of a GridFS bucket that match a filter on the files collection (filename, metadata.x, uploadDate, length)
The files of a GridFS bucket that match a filter on the files collection (filename, metadata.x, uploadDate, length)
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
bucket: The GridFS bucket name (fs by default when empty) - String - required
json_filter: The filter, a MongoDB query object ({} for all). Extended JSON is accepted: {"$oid": ...}, {"$date": ...} - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
bucket: The GridFS bucket name (fs by default when empty) - String - required
json_filter: The filter, a MongoDB query object ({} for all). Extended JSON is accepted: {"$oid": ...}, {"$date": ...} - String - required
admin
mongodb files "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "reports" "{\"metadata.owner\": \"finance\"}"
mentdb
[{"id": "6afc3b5b409bbfc231dec5d0", "filename": "sales-2026.csv", "size": 39, "upload_date": "2026-11-17T11:32:43.751Z", "metadata": {"owner": "finance", "year": 2026}}]
mongodb file_get <json_config> <bucket> <filename> <file_path>
Description
Write a GridFS file to a local file: the newest version of a name, or the file of an id. Returns {file, size}
Write a GridFS file to a local file: the newest version of a name, or the file of an id. Returns {file, size}
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
bucket: The GridFS bucket name (fs by default when empty) - String - required
filename: The name or the id in GridFS - String - required
file_path: The local file to write - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
bucket: The GridFS bucket name (fs by default when empty) - String - required
filename: The name or the id in GridFS - String - required
file_path: The local file to write - String - required
admin
mongodb file_get "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "reports" "sales.csv" "tmp/sales_copy.csv"
mentdb
{"file": "tmp/sales_copy.csv", "size": 39}
mongodb file_delete <json_config> <bucket> <filename>
Description
Delete every version of a GridFS file name, or the file of an id. Returns {deleted}
Delete every version of a GridFS file name, or the file of an id. Returns {deleted}
Parameters
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
bucket: The GridFS bucket name (fs by default when empty) - String - required
filename: The name or the id in GridFS - String - required
json_config: The connection as a JSON object: uri (mongodb:// or mongodb+srv://), or host and port; database; username with password; auth_source; tls; allow_plain (send credentials without TLS to a host that is not local); timeout_ms (10000, to find a server and connect); op_timeout_ms (600000, the longest wait for a reply); app_name - String - required
bucket: The GridFS bucket name (fs by default when empty) - String - required
filename: The name or the id in GridFS - String - required
admin
mongodb file_delete "{\"uri\": \"mongo_uri\", \"database\": \"shop\"}" "reports" "sales-2026.csv"
mentdb
{"deleted": 1}
