[CSHARP-806] Support Fieldname Indexers in a Linq Query Created: 26/Aug/13  Updated: 02/Apr/15  Resolved: 27/Aug/13

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

Type: Improvement Priority: Major - P3
Reporter: Craig Wilson Assignee: Craig Wilson
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

BsonDocuments should be able to be used in LINQ queries for when BsonDocuments are either the root or exposed as properties.

query = Query<BsonDocument>.Where(doc => doc["Name"] == "Bob McBob");
 
//
 
query = Query<BsonDocument>.Where(doc => doc["Children"][0]["Name"] == "Jack");
 
//
 
query = Query<BsonDocument>.Where(doc => doc["Children"][0]["Age"] > 20);



 Comments   
Comment by Pete Smith [ 20/Jun/14 ]

Hi Craig,

Sorry no issues, just a false alarm. I've found there was a slight change required to the MongoDocument from the pull request that I sent that wasn't illustrated in the test as it was initially commited, but is present in the latest version, i.e the overload of GetMemberSerializationInfo.

Thanks again!

Comment by Craig Wilson [ 20/Jun/14 ]

Hey Pete,

Are you saying it works as intended, or simply that you found the commit in the history? If it doesn't work, could you provide an example?

Craig

Comment by Pete Smith [ 20/Jun/14 ]

I am struggling to find any reference to the changes from this commit in the 1.9.1 source... am I missing something? The feature does not currently work as intended

https://github.com/mongodb/mongo-csharp-driver/commit/b6b772eec9a6fc1e7f03fc262927bbd6cb222a59

EDIT: Ahh found it... guess there was quite a large reshuffle that lost the audit trail. Sorry

Comment by auto [ 27/Aug/13 ]

Author:

{u'username': u'craiggwilson', u'name': u'Craig Wilson', u'email': u'craiggwilson@gmail.com'}

Message: CSHARP-806: add support for BsonDocument in LINQ queries.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/b6b772eec9a6fc1e7f03fc262927bbd6cb222a59

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