Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am new to Mongo db I have class structure like this for storing smilies and smilies category. I have made a mongodef property in smilies class for referencing smilies category collection but enable to get smilies category name...

public class smilies {
public ObjectId _id { get; set; }
public MongoDBRef scat_name{ get; set; }
public string smil_url { get; set; }
public string smil_detail { get; set; }
}

public class smilies_category {
public ObjectId _id { get; set; }
public string scat_name { get; set; }
}

and I am using below code for getting the record and records are coming but only from one document

function void getSmilies(){
var refDocument = new BsonDocument {
{"$ref", "smil_scat_id"},
{"$id", "539ef7c2e46b621314956e3b"}
};

var query = Query.EQ("smilies_category", refDocument);
var result = db.GetCollection("smilies").Find(query)

}

Now What I want here is combine resultset like


"_id" : ObjectId("539f3ec1e46b62120023d364"),
"scat_name : "Bussines",
"smil_url" : "www.gmail.com",
"smil_detail" : "Ok fine",

How can we achieve this?
Is I am going right way?
Please let me the know the solution
Posted
Updated 17-Jun-14 3:40am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900