2

Assume that we have two processes like following

# process 1

from pymongo import MongoClient

db = MongoClient().test

db.test.insert({'_id': test}, w=1)

send_data_ready()  # sending notification to another process
# process 2

from pymongo import MongoClient

db = MongoClient().test

def on_data_ready():
    # trying to read the document after notification received
    result = db.test.find_one({'_id': test})
    assert result

The first process makes some write operations and then notifying the second process that data is ready. Then the second process begins to read the modified data. Is it right that the second process always will read the new data? MongoDB started as a standalone server (not as a replica set). All write operations was made with acknowledged write concern ({w: 1}). Is there any guarantee of consistency between different connections? I didn't find it in the official documentation.

checkraise
  • 136
  • 6

0 Answers0