Greetings. There is a collection of entities in mongo. You need to make a method that will add only new entities without overwriting existing ones (ie, Replace with IsUpsert = true will not work). Now I get all the IDs from the base, then take them away from the list to be added and what's left is already inserted through InsertMany. But as the size of my database grows, the cost of the operation will increase, which is not very good. There is also an idea to wrap InsertMany in try ... except, but I'm not sure that this option is optimal. Help me please.

    0