i have collection of person in mongodb has structure this:
class person { public string { get; set; } public address houseaddress { get; set; } } class address { public string streetnumber { get; set; } public city currentcity { get; set; } } class city { public string name { get; set; } }
i want select city subfield of person. tried using excluding , including not working. tell me correct way in c#
i have tried code:
string jsonquery = @"{}, {'houseaddress.currentcity' : 1, _id:0}"; bsondocument query = mongodb.bson.serialization.bsonserializer.deserialize<bsondocument>(jsonquery); var squery = new querydocument(query); var cities = dbconnection.person.findas<person>(squery).setfields(fields.include("currentcity"));
Comments
Post a Comment