Docs Menu

Filter Incoming Queries

On this page

You can define filters on incoming queries that MongoDB Realm evaluates and applies before its initial query to your MongoDB cluster. Adding a filter to a collection allows you to control the shape of queried documents using projection filters and can improve query performance by reducing the number of documents for which Realm needs to evaluate a role.

Every filter consists of an Apply When JSON expression and a Filter Query document. When Realm receives an incoming MongoDB query, it evaluates the Apply When expression of all filters on the collection and merges the Filter Query document into the incoming query.

This guide walks through creating one or more query filters for a collection.

Note

This guide requires a linked MongoDB Atlas data source.

Give Feedback
© 2021 MongoDB, Inc.

About

  • Careers
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2021 MongoDB, Inc.