.net - Making a string property ObjectId in MongoDB with C# -
i started mongodb. using c# drivers. c# class looks this:
[bsonrepresentation(bsontype.objectid)] public string id { get; set; } public string userid { get; set; } public list<string> filters { get; set; }
with class able save , fetch records in mongodb.
what want:- instead of creating separate property hold id
(in case id
property), want make userid
property objectid.
please note, supplying userid unique string value
. possible achieve mongodb?
sure possible.
just put [bsonid] on userid prop , delete id property
Comments
Post a Comment