[SERVER-33684] Mongo Change Streams not returning all the updates to the collection Created: 05/Mar/18  Updated: 02/Apr/18  Resolved: 05/Mar/18

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: SAMBIT P KHANDAI Assignee: Kelsey Schubert
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

I am trying to use Change Streams to lookup/monitor the changes to a mongo collection.

cursor = db.collection.watch(full_document='updateLookup')
document = next(cursor)
print document['documentKey']

While using updateMany to update multiple documents at once, I'm not able to see all the changed documents. However if I update one at a time, then I see each change in the Stream.

db.collection.updateMany( {"contacts.firstName": "XXXXXX"}, { $set: {"LocationId" : 11111} } )
 
{ "acknowledged" : true, "matchedCount" : 77, "modifiedCount" : 77 }

Results:

{u'_id': ObjectId('580694d039811a468b96fc7b')}
{u'_id': ObjectId('58aeebed39811a468b974e97')}
{u'_id': ObjectId('59efe28b39811a468b97b9cc')}



 Comments   
Comment by Kelsey Schubert [ 05/Mar/18 ]

Hi sambitkhandai

Thanks for the update. Please note that the SERVER project is for reporting bugs or feature suggestions for the MongoDB server. For MongoDB-related support discussion please post on the mongodb-user group or Stack Overflow with the mongodb tag.

Kind regards,
Kelsey

Comment by SAMBIT P KHANDAI [ 05/Mar/18 ]

Thanks. Got the problem. Works fine now.

Comment by Asya Kamsky [ 05/Mar/18 ]

This works correctly for me. I suspect the issue is that you are not continuing to check the cursor.

Your next and print should be in some sort of a loop.

Generated at Thu Feb 08 04:34:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.