I need to call a MongoDB Stored JavaScript Function in C# Code.
My Stored JavaScript Function GetUserInfo
function() {
return db.getCollection('Profession').find({});
}
Execution :
db.loadServerScripts();
GetUserInfo();
It returns the Collection with following documents (Here I pasted only 2 Documents, in real I'm having more than 10K Documents)
{
"_id" : ObjectId("575845a713d284da0ac2ee81"),
"Profession_id" : "575841b313d284da0ac2ee7d",
"Prof_Name" : "Chief Officer"
}
{
"_id" : ObjectId("575845d213d284da0ac2ee82"),
"Profession_id" : "575841b313d284da0ac2ee7d",
"Prof_Name" : "Executive Officer"
}
In C#:
IMongoClient _client;
IMongoDatabase _database;
_client = new MongoClient();
_database = _client.GetDatabase("SampleDB");
Kindly assist me how to call MongoDB Stored JavaScript Function in C# Code.
The following Question uses Eval. In the latest driver, I can't able to find the Extended Function _database.Eval
Calling a Stored Procedure in MongoDB via C#
Kindly assist me...