[CSHARP-2536] how to get all documents where Incident ID's are given in comma seperated Created: 27/Feb/19  Updated: 05/Apr/19  Resolved: 04/Mar/19

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

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


 Description   

Hi Team,

I have a collection where i have incidents data in which if i pass the incident number more than 2 in comma separated, i want those documents into var variable.

Tried the below code but it is not working:

var filter = Builders<BsonDocument>.Filter.Eq("IncidentNumber", new[] { "INC12344444", "INC34455555" });

var result = collection.Find(filter).ToList();

Please give the right code.

 

Thanks,

G charan.

 



 Comments   
Comment by Ian Whalen (Inactive) [ 04/Mar/19 ]

charanreddy95 two things of note:

  • It appears you should be using In() rather than Eq() for this purpose.
  • Without seeing your data model, it's not possible for us to tell you whether this will actually match anything.

Just to let you know this project is for .NET driver bugs or feature requests. The best place for questions regarding MongoDB usage or the .NET driver specifics is the mongodb-user mailinglist or stackoverflow as you will reach a broader audience there. If your business requires an answer from MongoDB within a time frame then we do offer production support.

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