Dan
Dan

Reputation: 403

MongoDB locks on insert operations

While new rows are being inserted into a MongoDB collection, is it still possible to query old records ?

Is there any difference between WiredTiger and MMAPv1 in that regard ?

Upvotes: 0

Views: 3485

Answers (1)

ashisahu
ashisahu

Reputation: 397

WiredTiger

WiredTiger uses document level locking. WiredTiger is the default storage engine for mongodb from release 3.0

MMAPv1

MMAPv1 uses collection level locking from release 3.0 which is a huge improvement, as earlier, it was using database level locking. Also MMAPv1 was the default storage engine for mongodb prior to release 3.0.

Answer to your question now

As WiredTiger provides document level locking, and WiredTiger is the default storage engine from 3.0, you would be able to query old records in collection in Mongodb 3.0 and higher. But since Mongodb was using MMAPv1 as default storage engine before release 3.0, so in earlier releases, you would not be able to search for old records in a collection.

For more information, please refer to the following link :- https://docs.mongodb.org/manual/faq/concurrency/

Upvotes: 4

Related Questions