I'm doing two consecutive writes into the MongoDB (no shards, no replicas):
- insert data into db
- find and modify data inserted in 1.
when performing step 2), is it granted, that the command sees the data insertion from step 1)? What is the minimal WriteConcern I should use in step 1) to ensure this?
As for my use-case, I know, I could merge 1 and 2 into one simple step; however, my real use-case is much more complicated and cannot be solved such easily.
Your use case will work given you are using a write concern of Acknowledged. This is the default write concern in MongoDB 2.2 or later given you are using a recent driver (see here for the minimum driver version required).
http://docs.mongodb.org/manual/release-notes/drivers-write-concern/