Hi Guys,
Actually, I tried to perform joins on MongoDB using C# driver.
as, that's not possible. I've tried to create a function on mongoDB and get the query result to my C# code. But I'm unable to get the result.
My MongoDB Function
function(GroupId) {
var contacts = db.CLIENT_CONTACTS.find({
Group_Id: GroupId
}, {
MOBILE_NUMBER: 1,
_id: 0
});
var dd = '';
var abc = contacts.forEach(
function(x) {
dd = dd + ',' + x.MOBILE_NUMBER;
})
dd = dd.substring(1, dd.length)
var number = dd.split(',')
return db.USERINFO.find({
'MOBILENO': {
$in: number
}
}, {
GENDER: 1,
MOBILENO: 1,
_id: 0
})
}
So, My function result will be a Collection with 2 columns.
Actually, I've tried some piece of code for getting the mongoDB function result.
My C# Code
BsonValue bv = MongoConnection.database.Eval("GetUnMeContacts");
BsonValue bv1 = MongoConnection.database.Eval(bv.AsBsonJavaScript.Code, 3262);
Console.WriteLine(bv1);
But, I'm not getting the result. I've taken a
screenshot of my result.
Actually, I'm getting the mongoDB function query and some other properties in the result.
Can anyone suggest me the correct way to get the result?
Thanks in advance.