Hi,
I have a .once publication, I subscribe to it and I have a method which call removeAsync.
So the document is soft deleted on server side but not changed message is sent to the client.
looking at the mongo.js code, in the updateAsync (at the end updateAsync is called as it is soft delete so we update the deleted field to true ) part :
const finalFilter = hasId ? filter : insertedId ? { _id: insertedId } : docIds ? {_id: numberAffected === 1 ? docIds[0] : { $in: docIds }} : undefined;
const { projection, unsets = [] } = finalFilter && createProjection(modifier);
const items = finalFilter ? await this.find(finalFilter, { projection }).fetchAsync() : [];
with finalFilter = { _id: ObjectID { _str: '6a1a43125abc95913356c0c7' }
and projection = { deleted: 1, deletedAt: 1, updatedAt: 1 }
items, at the end, is equal to [] so no changed message sent
If I modify for testing pupose finalFilter to { _id: ObjectID { _str: '6a1a43125abc95913356c0c7', deleted: true }
items is not empty ans the changed message is correctly sent
Hi,
I have a
.oncepublication, I subscribe to it and I have a method which callremoveAsync.So the document is soft deleted on server side but not
changedmessage is sent to the client.looking at the
mongo.jscode, in theupdateAsync(at the endupdateAsyncis called as it is soft delete so we update the deleted field totrue) part :with
finalFilter = { _id: ObjectID { _str: '6a1a43125abc95913356c0c7' }and
projection = { deleted: 1, deletedAt: 1, updatedAt: 1 }items, at the end, is equal to[]so nochangedmessage sentIf I modify for testing pupose finalFilter to
{ _id: ObjectID { _str: '6a1a43125abc95913356c0c7', deleted: true }itemsis not empty ans thechangedmessage is correctly sent