[CSHARP-1513] How to run query specified below using c# driver Created: 15/Dec/15 Updated: 05/Apr/19 Resolved: 04/Jan/16 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | API |
| Affects Version/s: | 1.10.1 |
| Fix Version/s: | None |
| Type: | Task | Priority: | Blocker - P1 |
| Reporter: | Nikhil Salunkhe | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | question | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
I am running following query in RoboMongo which seems to work fine. I want to run same query using C# driver version - 1.10.1.73 ) |
| Comments |
| Comment by Nikhil Salunkhe [ 16/Dec/15 ] | |||||
|
Out of interest is there a method/call inside .NET driver where i can pass e.g Thank you in advance. Nikhil On Tue, Dec 15, 2015 at 11:07 PM, Nikhil Salunke <nikhilsalunkhe@gmail.com> | |||||
| Comment by Nikhil Salunkhe [ 16/Dec/15 ] | |||||
|
Great!. This works as expected. Reason we are trying to call find command the way it is called because we Thank you, Robert. [image: Inline image 1] Regards, On Tue, Dec 15, 2015 at 10:26 PM, Robert Stam (JIRA) <jira@mongodb.org> | |||||
| Comment by Robert Stam [ 16/Dec/15 ] | |||||
|
I can't quite read your code to create the command, but it looks like you are setting the filter field to a string instead of a query document. It should look like this:
Also, you wouldn't normally call the find command yourself. Just use the Find methods on MongoCollection and let the driver do the find using whatever protocol is appropriate for the version of the server you are connected to. The API for version 2.x of the driver is slightly different. |