I am having issues whereby writes to a collection followed by immediate reads from that collection do not return (a subset of) the writes just made. I understand writes to the db are asynchronous, hence I performed a db.lock! operation before reading the collection.
As I understand, the lock! operation should flush all writes to the datafile, and then lock the database. However, even after the lock! operation, subsequent find operations from the collection sometimes do not render all the items that were written to the collection before the lock!.
I am running this test within Rspec.