Hey everyone!
I have a question about how publications handle $addToSet queries.
Lets say we had a publication that publishes changes on our user collection.
The cursor is giving us an array property on the documents among other things.
If we update a user document and use $addToSet, does the oplog driver know how to handle this case? or does it fall back to using the polling/diff method?
How does Meteor handle this? Would all subscriptions to this publication trigger a read on the users collection for diff purposes?
Meteor.publish('myUser', function () {
const handle = this;
const userCursor = Meteor.users.find({
_id: this.userId,
}, {
fields: {
arrayProperty: 1,
}
});
const observeHandle = userCursor.observe({
...
changed: function (doc) {
handle.added('users', userId, user);
},
...
});
});
//Update a user doc with $addToSet
Meteor.users.update({ _id: '123' }, {
$addToSet: {
arrayProperty: 'test',
},
});