Use ObjectId.GenerateNewId() or leave MongoDB to create one?

When you insert a new mongodb document the son driver check if exist a property with the BsonId AttributeClass. If exist and is null it create a new ObjectId, if doesn't exist during the document insertion mongodb will generate e new ObjectId.
Sometimes users encounter problem with "only zero" ObjectId, for this reason my suggestion is to use a combination of BsonID attribute class and ObjectId.GenerateNewId so you are sure that that property will not have weird behaviour.
e.g.

public class SomeClass {

    [BsonId]
    public ObjectId MySuperId { get; set; }

    public SomeClass() {
        this.MySuperId = ObjectId.GenerateNewId();
    }

}

Tags:

C#

Mongodb