-
Type: Improvement
-
Resolution: Done
-
Priority: Minor - P4
-
None
-
Affects Version/s: 1.7.1
-
Component/s: Feature Request
-
None
-
Environment:new driver method
now I fetch dbref by following code:
BsonDocument doc = test.FindOne();
var l = doc.Elements.ElementAt(1);
var linkr=l.Value;//dbref there
MongoDBRefSerializer ser=new MongoDBRefSerializer();
BsonReader reader = BsonReader.Create(linkr.ToJson());
var refrefref= ser.Deserialize(reader, typeof(MongoDBRef), new opt());
MongoDBRef a = (MongoDBRef)refrefref;
var referenced = db.FetchDBRef(a);
opt class
class opt : IBsonSerializationOptions
{
public void ApplyAttribute(IBsonSerializer serializer, Attribute attribute)
public IBsonSerializationOptions Clone()
{ throw new NotImplementedException(); }
public IBsonSerializationOptions Freeze()
{ throw new NotImplementedException(); } }
i dont know why code so long and there is a lot of unnessesary types?
i think it would be better to add following method to fetchdbref:
BsonDocument doc = test.FindOne();
var l = doc.Elements.ElementAt(1);
var linkr=l.Value;//dbref there
MongoDBRef refer = linkr.AsDBRef() //
var profit = db.FetchDBRef(refer);
if possible.
thank you.