MongoDB MCP Server
by jonfreeland
find_by_ids
Find multiple documents by their IDs in a single request.
Advantages:
- More efficient than multiple single document lookups
- Preserves ID order in results when possible
- Can filter specific fields with projection
- Handles both string and ObjectId identifiers
Example: use_mcp_tool with server_name: "mongodb", tool_name: "find_by_ids", arguments: { "collection": "products", "ids": ["5f8d0f3c", "5f8d0f3d", "5f8d0f3e"], "idField": "_id", "projection": { "name": 1, "price": 1 } }
Input Schema
Name | Required | Description | Default |
---|---|---|---|
collection | Yes | Collection name | |
database | No | Database name (optional if default database is configured) | |
idField | No | Field containing the IDs (default: "_id") | |
ids | Yes | Array of document IDs to look up | |
projection | No | MongoDB projection to specify fields to return (optional) |