//public static bool ResultToGrid = false; //public static bool ResultToText = false; public static void Eval(string code, string databaseName = "admin", string server = null) { MongoDatabase database = MongoCommand.GetDatabase(server, databaseName); //if (code.StartsWith("{") && code.EndsWith("}")) // code = "db.runCommand( " + code + " )"; //EvalArgs evalArgs = new EvalArgs { Code = new BsonJavaScript(code) }; EvalArgs evalArgs = code.zToEvalArgs(); Trace.WriteLine("Eval : {0} {1}", database.zGetFullName(), evalArgs.ToJson()); // obsolete : 'MongoDB.Driver.MongoDatabase.Eval(MongoDB.Bson.BsonJavaScript, params object[])' is obsolete: 'Use the overload of Eval that has an EvalArgs parameter instead.' // BsonValue Eval(BsonJavaScript code, params object[] args); BsonValue result = database.zEval(evalArgs); Trace.WriteLine(result.zToJson()); }