say I have a product listing. When I add a new product I save it using something like
var doc=products.Insert(p);
The pro
As the comment above, add the fild ID in your model with
[BsonId]
[BsonRepresentation(BsonType.ObjectId)]
public string id { get; set; }
using:
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
and then when you insert the object, mongo return the ID of the document into the fild ID of the model.