Join GitHub today
Add to database only if unique #53
Add a helper function that you can easily add new entities to the DB only if the entities do not already exist based on a specified column. This would need to perform a read before it could perform the write to ensure it doesn't exist.
This being said, the functionality could probably work out-of-the-box with Unique Indexes - just depends how it handles failed writes in bulk or not. If it throws an exception, that would be a problem. https://docs.mongodb.com/manual/core/index-unique/
Further investigation required before adding this feature.