A
A
Anton2021-03-12 14:50:37
MongoDB
Anton, 2021-03-12 14:50:37

Does the {unique:true} option restrict the creation of new documents in the MongoDb collection?

Hello.
If you create an index createIndex({"name":1}, {unique:true}) for the "name" field of the db.users collection, then it will not be possible to place documents with the same "name" field in it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan, 2021-03-13
@hunk3r

The monge documentation says that the collection will not accept the creation and modification of records if the value of the index field matches the ones already present.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question