[CSHARP-713] MongoDatabase.Eval doesn't send argument to server when there is exactly one argument Created: 26/Mar/13  Updated: 20/Mar/14  Resolved: 26/Mar/13

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

Type: Bug Priority: Major - P3
Reporter: Keith Anders Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: c#, driver, eval, javascript
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows 7 x64, connecting to MongoDB 2.4.0, Visual Studio 2010


Attachments: Zip Archive JavascriptTest.zip    

 Description   

When using db.eval(myJS, "myStringArgument"), any attempt to use the argument in a javascript context will treat it as undefined, and any attempt to use it in a BSON context will use it as BsonNull. In the attached sample solution, the return value of the function comes up as BsonNull, and the document saved to the database is of the form

{ name: null }

.



 Comments   
Comment by auto [ 26/Mar/13 ]

Author:

{u'date': u'2013-03-26T21:18:57Z', u'name': u'rstam', u'email': u'robert@10gen.com'}

Message: CSHARP-713: MongoDatabase.Eval doesn't send argument to server when there is exactly one argument.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/072aad48b788f066ce3315ef6ab2256efa4b49d9

Comment by Robert Stam [ 26/Mar/13 ]

MongoDatabase.Eval only fails when there is exactly one argument.

A workaround for now could be to pass an extra dummy argument.

Thanks for reporting the issue.

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