.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

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -