MongoDB中存储的javaScript的C#调用不是比使用MongoDB C#驱动程序查询API更高效,更好吗?
所有:
以下是有关我的开发环境的信息:
-
MongoDB 3.0.0
MongoDB C#驱动程序版本1.7.0.4714
Microsoft Visual Studio Professional 2013
.NET Framework 4.0
使用MongoDB C#驱动程序版本1.7.0.4714 API,我可以使用IMongoQuery和Query对象构建查询,
但是,当查询涉及MongoDB集合之间的大量“准连接”时,我发现很难使用MongoDB C#驱动程序版本1.7.0.4714 API实现查询。
此外,如果您将MongoDB世界中的大量数据作为POCO对象列入C#world,我相信它会降低性能。
所以,我在考虑采用使用C#调用MongoDB中存储的JavaScript的实现方法是否合适。
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 usersOfInterestList = bv3.AsBsonArray.AsQueryable();
与使用MongoDB C#驱动程序版本1.7.0.4714 API查询API相比,开始在MongoDB中使用存储的javaScript的C#调用是否更好?