[CSHARP-1327] Mongo Database queries in c#.net Created: 19/Jun/15 Updated: 05/Apr/19 Resolved: 22/Jun/15 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | API |
| Affects Version/s: | 2.0.1 |
| Fix Version/s: | None |
| Type: | Task | Priority: | Major - P3 |
| Reporter: | Arvind Chary | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 0 |
| Labels: | question | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Windows |
||
| Attachments: |
|
| Description |
|
I am using Mongo CSharpDriver-2.0.0 version and IMongoCollection Async in my application. My data collection looks as shown in the figure attached(2.png). var collection = _database.GetCollection<BusinessDeal>("BusinessDeals"); But my requirement is to get the records when I provide a Comma separated categories List. For that implementation I have implemented the following code: |
| Comments |
| Comment by Arvind Chary [ 22/Jun/15 ] | |||
|
Hello Craig, Thanks, | |||
| Comment by Craig Wilson [ 19/Jun/15 ] | |||
|
Hi Arvind, For future reference, questions such as this are better asked on stackoverflow or our discussion list: https://groups.google.com/forum/?pli=1#!forum/mongodb-user. First off, you'll want to use just In instead of AnyIn. Other than that, have you taken into account that your comma separated list might have whitespace? "One, Two" instead of "One,Two"? Second, you can see exactly what query is getting generated by using ToString() on the result of the Find:
It would be helpful to know what query is actually getting generated and, if it looks correct, does it run in the shell? Craig |