Tim
Tim

Reputation: 99428

In MongoDB, does a lock apply to a collection, a database, or a server?

In a MongoDB server, there may be multiple databases, and each database can have multiple collections, and a collection can have multiple documents.

Does a lock apply to a collection, a database, or a server?

I asked this question because when designing MongoDB database, I want to determine what is stored in a database and what is in a collection. My data can be partitioned into different parts, and I hope to be able to move a part from a MongoDB server to a filesystem, without being hindered by the lock that applies to another part, so I wish to store the parts of data in a way that different parts have different locks.

Thanks.

Upvotes: 0

Views: 418

Answers (1)

Mateo Barahona
Mateo Barahona

Reputation: 1391

From the official documentation : https://docs.mongodb.com/manual/faq/concurrency/

Basically, it's global / database / collection.

But with some specific storage engines, it can lock at document level too, for instance with WiredTiger (only with Mongo 3.0+)

Upvotes: 1

Related Questions