From Discover Meteor: find() returns a cursor, which is a reactive data source.
Data from reactive sources will be updated automatically to track changes in the data used to generate it. Cursors are derived from specific sources:
- Session variables
- Database queries on Collections
- The ready() method on a subscription handle
1 2 3 4 5 6 7 8 9 10 11 12 13 14
Cursors are not query snapshots. They are query snapshot containers — the contents of which are updated by changes to the underlying data. To interact with the data contained in a cursor, we can use fetch() to transform the cursor into an array.
1 2 3 4 5 6 7 8 9
Meteor can iterate over a cursor without first converting it to an array, but in order to interact with the data directly, you must first use fetch(), map(), or forEach(). For more cursor fun, checkout the Meteor docs.