docbase
v0.1.0MongoDB tools: query, aggregate, index, and administer collections and databases.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
connect
Connect to a MongoDB instance
| Parameter | Type | Description |
|---|---|---|
connectionString | string | MongoDB connection string (mongodb:// or mongodb+srv://) to connect with; overrides the configured connection for this call. |
list-databases
List all databases in the connected MongoDB instance
list-collections
List collections in a MongoDB database
| Parameter | Type | Description |
|---|---|---|
database * | string | Name of the MongoDB database whose collections to list. |
collection-schema
Describe the schema for a collection
| Parameter | Type | Description |
|---|---|---|
collection * | string | Name of the collection whose schema to describe. |
database * | string | Name of the MongoDB database containing the collection. |
collection-indexes
List indexes for a collection
| Parameter | Type | Description |
|---|---|---|
collection * | string | Name of the collection whose indexes to list. |
database * | string | Name of the MongoDB database containing the collection. |
collection-storage-size
Get the storage size of a collection
| Parameter | Type | Description |
|---|---|---|
collection * | string | Name of the collection whose storage size to report. |
database * | string | Name of the MongoDB database containing the collection. |
find
Run a find query against a MongoDB collection
| Parameter | Type | Description |
|---|---|---|
collection * | string | Name of the collection to query. |
database * | string | Name of the MongoDB database containing the collection. |
filter | object | MongoDB query filter document matching the documents to return. |
limit | number | Maximum number of documents to return; must be positive. |
projection | object | Projection document controlling which fields are returned in each document. |
sort | object | Sort document mapping each field to its sort direction (1 for ascending, -1 for descending). |
aggregate
Run an aggregation pipeline against a MongoDB collection
| Parameter | Type | Description |
|---|---|---|
collection * | string | Name of the collection to run the aggregation pipeline against. |
database * | string | Name of the MongoDB database containing the collection. |
pipeline * | array | Aggregation pipeline stages, each an object such as a $match or $group stage, applied in order. |
count
Count documents in a MongoDB collection
| Parameter | Type | Description |
|---|---|---|
collection * | string | Name of the collection whose documents to count. |
database * | string | Name of the MongoDB database containing the collection. |
query | object | Query filter document selecting the documents to count. |
insert-many
Insert documents into a MongoDB collection
| Parameter | Type | Description |
|---|---|---|
collection * | string | Name of the collection to insert the documents into. |
database * | string | Name of the MongoDB database containing the collection. |
documents * | array | Documents to insert; a non-empty array of objects. |
update-many
Update documents in a MongoDB collection
| Parameter | Type | Description |
|---|---|---|
collection * | string | Name of the collection whose documents to update. |
database * | string | Name of the MongoDB database containing the collection. |
filter * | object | Filter document selecting the documents to update. |
update * | object | Update document to apply to the matching documents, for example using update operators such as $set. |
delete-many
Delete documents from a MongoDB collection
| Parameter | Type | Description |
|---|---|---|
collection * | string | Name of the collection whose documents to delete. |
database * | string | Name of the MongoDB database containing the collection. |
filter * | object | Filter document selecting the documents to delete; all matching documents are deleted. |
create-collection
Create a new collection in a MongoDB database
| Parameter | Type | Description |
|---|---|---|
collection * | string | Name of the new collection to create. |
database * | string | Name of the MongoDB database in which to create the collection. |
drop-collection
Drop a collection from a MongoDB database
| Parameter | Type | Description |
|---|---|---|
collection * | string | Name of the collection to drop. |
database * | string | Name of the MongoDB database containing the collection. |
drop-database
Drop a MongoDB database
| Parameter | Type | Description |
|---|---|---|
database * | string | Name of the MongoDB database to drop. |
rename-collection
Rename a MongoDB collection
| Parameter | Type | Description |
|---|---|---|
collection * | string | Current name of the collection to rename. |
database * | string | Name of the MongoDB database containing the collection. |
newName * | string | New name for the collection, within the same database. |
create-index
Create an index on a MongoDB collection
| Parameter | Type | Description |
|---|---|---|
collection * | string | Name of the collection to create the index on. |
database * | string | Name of the MongoDB database containing the collection. |
keys * | object | Index keys document mapping each field to its index direction or type (for example 1, -1, or "text"); must name at least one field. |
drop-index
Drop an index from a MongoDB collection
| Parameter | Type | Description |
|---|---|---|
collection * | string | Name of the collection to drop the index from. |
database * | string | Name of the MongoDB database containing the collection. |
indexName * | string | Name of the index to drop from the collection. |
explain
Get the execution plan for a MongoDB query
| Parameter | Type | Description |
|---|---|---|
collection * | string | Name of the collection the explained operation runs against. |
database * | string | Name of the MongoDB database containing the collection. |
method | array | Array naming the operation method to explain; the first entry is used and find is used when this is omitted. |
methodArgs | object | Arguments document for the explained method, merged into the operation being explained. |
export
Export a MongoDB collection to a file
| Parameter | Type | Description |
|---|---|---|
collection * | string | Name of the collection to export. |
database * | string | Name of the MongoDB database containing the collection. |
exportTitle | string | Title for the export; the collection name is used when this is omitted. |
filter | object | Filter document selecting the documents to export. |
db-stats
Get statistics for a MongoDB database
| Parameter | Type | Description |
|---|---|---|
database * | string | Name of the MongoDB database whose statistics to return. |
mongodb-logs
Retrieve MongoDB log entries
| Parameter | Type | Description |
|---|---|---|
limit | number | Maximum number of log lines to return; must be positive. |
type | string | Log type or component to retrieve; global is used when this is omitted. |