db.Eval(evalArgs) not working from c sharp

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Blocker - P1
    • None
    • Affects Version/s: None
    • Component/s: None
    • Environment:
      Windows
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Hi,
      I am unable to work with db.Eval function.
      After passing BsonDocument in EvalArgs, it throws "type cast error".

      My code:
      EvalArgs ea = new EvalArgs();
      BsonJavaScript bjs = new BsonJavaScript("function()

      { return db.bar.count(); }

      ");
      ea.Code = bjs;
      db.Eval(ea);

      This returns nothing, while the code runs in mongo shell when directly executed.

      Thanks
      Anurag

            Assignee:
            Unassigned
            Reporter:
            Anurag
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: