> ## Documentation Index
> Fetch the complete documentation index at: https://docs.datris.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Query MongoDB

> Query a MongoDB collection with optional filter and projection. Blocks $where and $function operators.



## OpenAPI

````yaml /openapi.yaml post /api/v1/query/mongodb
openapi: 3.0.3
info:
  title: Datris API
  description: >
    REST API for the Datris AI Data Platform. Ingest, validate, transform,
    store, and retrieve data.


    For AI agent integration, use the [MCP
    Server](https://docs.datris.ai/mcp-server) instead.
  version: 1.11.3
  contact:
    name: Datris
    url: https://datris.ai
  license:
    name: Apache 2.0
servers:
  - url: http://localhost:8080
    description: Local development
security:
  - ApiKeyAuth: []
paths:
  /api/v1/query/mongodb:
    post:
      tags:
        - Query
      summary: Query MongoDB
      description: >-
        Query a MongoDB collection with optional filter and projection. Blocks
        $where and $function operators.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - collection
              properties:
                collection:
                  type: string
                  description: MongoDB collection name
                filter:
                  type: object
                  default: {}
                  description: MongoDB query filter
                projection:
                  type: object
                  description: Fields to include/exclude
                limit:
                  type: integer
                  default: 20
                  description: >-
                    Maximum documents to return. Use -1 for unlimited (no row
                    cap).
      responses:
        '200':
          description: Query results
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryResponse'
        '500':
          description: Error
components:
  schemas:
    QueryResponse:
      type: object
      properties:
        results:
          type: array
          items:
            type: object
        count:
          type: integer
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Optional API key for authentication (enabled via application.yaml)

````