All:
Here is the information about my development environment:
MongoDB 3.0.0
MongoDB C# Driver Version 1.7.0.4714
Microsoft Visual Studio Professional 2013
.NET Framework 4.0
Using the MongoDB C# Driver Version 1.7.0.4714 API, I can construct queries using IMongoQuery and the Query object,
However, I find it difficult to implement queries using the MongoDB C# Driver Version 1.7.0.4714 API when the query involves a lot of "quasi-joins" between MongoDB Collections.
Also, I believe it slows performance if you bring in large amount of data from MongoDB world into C# world as POCO objects in a list.
So, I was thinking if it would be good to adopt the implementation practice of using C# to invoke stored JavaScript in MongoDB.
var sysJs = DBConnection.database.GetCollection("system.js");
sysJs.Remove(Query.EQ("_id", "getUsers"));
var code = File.ReadAllText(HttpContext.Current.Server.MapPath("~/Hos/quasiStoredProcedures JS/getUsers.js"));
var codeDocument = new BsonDocument("value", new BsonJavaScript(code));
codeDocument.Add(new BsonElement("_id", "getUsers"));
sysJs.Insert(codeDocument);
BsonValue getUsers = DBConnection.database.Eval("getUsers");
BsonValue bv3 = DBConnection.database.Eval(getUsers.AsBsonJavaScript.Code, null
,
loggedInUser.CompanyID
,
searchTermArg
,
ApplicationConstants.DriverRole
,
startRowOfInterest
,
displayedRowsQuantity
,
sortColumn
,
isAscending);
IEnumerable<Users> usersOfInterestList = bv3.AsBsonArray.AsQueryable();
Is it better to start using C# invocation of stored javaScript in MongoDB as opposed to used MongoDB C# Driver Version 1.7.0.4714 API Query API?