find
Query a MongoDB collection to retrieve documents matching filters, with optional sorting, projection, and limit controls.
Instructions
Run a find query against a MongoDB collection
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sort | No | A document, describing the sort order, matching the syntax of the sort argument of cursor.sort(). The keys of the object are the fields to sort on, while the values are the sort directions (1 for ascending, -1 for descending). | |
| limit | No | The maximum number of documents to return | |
| filter | No | The query filter, matching the syntax of the query argument of db.collection.find() | |
| database | Yes | Database name | |
| collection | Yes | Collection name | |
| projection | No | The projection, matching the syntax of the projection argument of db.collection.find() | |
| connectionId | Yes | The connection to run the operation against. Use the id returned by one of the connect tools, or "preconfigured" to use the connection string the server was configured with. | |
| responseBytesLimit | No | The maximum number of bytes to return in the response. This value is capped by the server's configured maximum and cannot be exceeded. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| documents | Yes | The documents returned by the find query | |
| appliedLimits | Yes | The limits applied to the find query | |
| queryResultsCount | No | The total number of documents returned by the find query |