[CSHARP-1098] db.Eval(evalArgs) not working from c sharp Created: 06/Nov/14  Updated: 05/Apr/19  Resolved: 04/Apr/15

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Blocker - P1
Reporter: Anurag Assignee: Unassigned
Resolution: Done Votes: 0
Labels: question
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows



 Description   

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



 Comments   
Comment by Craig Wilson [ 06/Nov/14 ]

Hi. Sorry you are having trouble. I'll look into this. In the meantime, could you explain why you need "eval"? In general, it has some very bad effects on the server regarding performance and, in almost all cases, isn't actually needed. Perhaps you could explain what you are trying to do and we can come up with a better solution.

Generated at Wed Feb 07 21:38:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.