I have a collection that with something like:
{
_id: 'abc',
_remoteId: 'xyz',
submitted_on: ISODate('2015-01-24T15:00:39.171Z"');
}
Where _remoteId
is a reference to another collection. What I need is to publish the latest of documents, grouped by _remoteId. I think I need to use the $group
aggregate, but the only examples (example here) seem to not return a Cursor, and thus do not seem to be reactive. Is there a way to publish a group aggregate in such a way to be reactive, either by returning a Cursor directly or by observing on the server and setting up the updates manually?
The second code snippet in the example that you reference shows how you would create a reactive cursor. He missed returning it though... at the end of the
previousInviteContacts
, he should have returned:Other than that, to consume it, just subscribe to the
previousInviteContacts
publication and query thecontacts
collection.