Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

176
Views
Mongodb changestream pipeline query does not work

My document is like this:

{
    "_id": {
        "$oid": "6257a55d04bf2167733f5b72"
    },
    "attributes": {
        "CustomerName": "John",
        "CustomerID": "28374",
        "LoanID": "82349327409234"
    },
    "type": "Record"
}

My changestream watch is like this:

var watchCursor = db.transactions.watch([ {$match: {"attributes.LoanID": { $exists : true }}} ]);
while (!watchCursor.isExhausted()){
   if (watchCursor.hasNext()){
      print(JSON.stringify(watchCursor.next()));
   }
}

But the change stream can't find this document. Any thoughts? Note that my search query is after the nested field inside attributes.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Ah the reason is because the changestream event document is not an exact copy of the actual document.

In case of an update, the actual document resides in updateDescription.updatedFields and in case of an insert it resides in fullDocument field.

Ref: Mongodb change-events

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!