Widgets for Live Queries
This is the number of documents fetched from MongoDB via observers. Meteor fetches documents from MongoDB in a few different cases. Here are some of them:
- When a new observer is created (for the initial dataset)
- Every 10 seconds, if this observer is not using the oplog
- When the observer’s internal buffer becomes empty (with oplog observers only)
Once an observer is created, it’ll trigger events in a few different scenarios. Here a list of those event types:
- Added (Initially) - When an observer is created for the first time, it’ll fetch the initial set of documents from MongoDB and trigger this event for each document.
- Added - If a new document satisfies the query, then the observer will trigger this event with that document.
- Updated - If there is a change to an already added document, then the observer will trigger this event with the changes.
- Removed - If an existing document does not satisfy the query, then the observer will trigger this event with that document’s ID.
Meteor watches the MongoDB oplog to observe changes happening in the MongoDB. If something happens in the DB, Meteor will receive it as a notification. The notification is attached to a collection. Then, Meteor will forward this notification to most of the observers created for that collection.
There are few different types of oplog notifications. They are:
- Inserted - When a new document is added to the collection
- Updated - When a document is updated in the collection
- Removed - When a document is removed from the collection
Meteor will receive all these notification regardless of whether it has a related observer or not.
This is a breakdown of publications sorted by the different metrics related to Live Queries. They include:
- Fetched Documents
- Observer Reuse: Descending
- Observer Reuse: Ascending
- Observer Changes: Total
- Observer Changes: Live Updates
- Observer Changes: Added (Initially)
- Observer Changes: Added
- Observer Changes: Changed
- Observer Changes: Removed
- Oplog Notifications: Low
This is a set of important metrics of your app’s Live Queries. It includes following metrics:
- Fetched Documents
- Live Updates
- Observer Reuse Ratio
- Observe Lifetime