Rakesh Sharma
2014-06-16 19:50:08 UTC
Hi I have class structure like this
public class smilies
{
public ObjectId _id { get; set; }
public MongoDBRef smilies_category{ 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
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 result like
"_id" : ObjectId("539f3ec1e46b62120023d364"),
"scat_name : "Bussines",
"smil_url" : "www.gmail.com",
"smil_detail" : "Ok fine",
I have referenced smilies category in smiles to get the name of smilies
category
How can we achiev this in Mongo Db?
Is I am going right way?
Please let me know ..?
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to mongodb-user-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/cd9cbaa6-b423-4115-9af0-d85faec2b89e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
public class smilies
{
public ObjectId _id { get; set; }
public MongoDBRef smilies_category{ 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
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 result like
"_id" : ObjectId("539f3ec1e46b62120023d364"),
"scat_name : "Bussines",
"smil_url" : "www.gmail.com",
"smil_detail" : "Ok fine",
I have referenced smilies category in smiles to get the name of smilies
category
How can we achiev this in Mongo Db?
Is I am going right way?
Please let me know ..?
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To post to this group, send email to mongodb-user-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/cd9cbaa6-b423-4115-9af0-d85faec2b89e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.