Docs Menu

Watch for Document Changes

On this page

  • Overview
  • Use Cases
  • Examples

MongoDB Realm allows you to watch a collection and receive client-side database events whenever documents in the collection are inserted or modified. This enables you to develop real-time and collaborative applications without the overhead and complexity of alternatives such as long polling.

Realm uses MongoDB change streams on watched collections to listen for changes and broadcast them to any client applications that are watching documents in the collection at the time of the event. Realm supports watching any change on a collection and watching changes that match a certain filter.

Change Stream Limitations

Realm opens a single MongoDB change stream for each watched collection and limits the total number of open change streams on each linked cluster across all Realm apps based on the cluster's size. See change stream limitations for more information.

The API provides real-time notifications to client apps whenever a document in a specified collection changes. This is useful for cases where you want to know when something happened while a user is online. For example:

  • Track the location of a delivery
  • Get the most up-to-date score and stats for a game
  • Update a chat thread when a user sends a new message

Change streams returned by the watch() API are not resumable and only process changes while a user is online. As a result, they are not generally suited for use cases where you must ensure that every update is processed. To handle reactive business logic like this, use triggers.

For code examples of watching collections, refer to the client SDKs:

Welcome to the MongoDB Realm Docs →
Give Feedback
© 2022 MongoDB, Inc.


  • Careers
  • Investor Relations
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2022 MongoDB, Inc.