There are collections in which it makes sense not to insert records, if a certain value is already contained.
E.g. the package collection, for which it does not make sense to have multiple entries for the same version.
In SQL the UNIQUE attribute is doing exactly this. There should be a way to do it even in MongoDB, let's just check if it's convenient, or better to manually search.
There are collections in which it makes sense not to insert records, if a certain value is already contained. E.g. the
package
collection, for which it does not make sense to have multiple entries for the same version.In SQL the
UNIQUE
attribute is doing exactly this. There should be a way to do it even in MongoDB, let's just check if it's convenient, or better to manually search.https://www.mongodb.com/docs/manual/core/index-unique/ https://pymongo.readthedocs.io/en/stable/api/pymongo/collection.html#pymongo.collection.Collection.create_index