I'm using watch()
function of mongo to listen to changes made to a replicaSet, now I know I can get the whole document (fullDocument) by passing { fullDocument: 'updateLookup' }
to the watch method,
like :-
someModel.watch({ fullDocument: 'updateLookup' })
But what I really want to do is, get just one extra field which isn't changed every time a new update is made.
Let's say a field called 'user_id'
, currently I only get the updatedFields
and the fullDocument
which contains the 'user_id'
along with a lot of other data which I would like to avoid.
What I have researched so far is Aggregation pipeline
but couldn't figure out a way to implement it.
Can anybody help me figure out a way to this?