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')}