Closed marcelnicolay closed 12 years ago
from mongotor.database import Database from mongotor.node import ReadPreference from bson import ObjectId
db = Database.connect(["localhost:27027", "localhost:27028"], dbname='test', read_preference=ReadPreference.SECONDARY_PREFERRED)
doc = {'_id': ObjectId()} yield gen.Task(db.test.insert, doc)
time.sleep(2)
doc_found, error = yield gen.Task(db.test.find_one, doc)
assert doc_found == doc
from mongotor.database import Database from mongotor.node import ReadPreference from bson import ObjectId
db = Database.connect(["localhost:27027", "localhost:27028"], dbname='test', read_preference=ReadPreference.SECONDARY_PREFERRED)
doc = {'_id': ObjectId()} yield gen.Task(db.test.insert, doc)
wait replication
time.sleep(2)
doc_found, error = yield gen.Task(db.test.find_one, doc)
assert doc_found == doc