Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-1585

Support for Filters without name in C# Driver

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major - P3
    • Resolution: Unresolved
    • Affects Version/s: 2.2.3
    • Fix Version/s: None
    • Labels:
    • Environment:
      Windows, Mac, C#, MongoDB 3.2, C# Driver 2.2.3 and earlier.

      Description

      I'm trying to translate following MongoDB shell query into C# query.

      db.col.find({"Details.a":{$elemMatch:{$elemMatch:{DeviceName : /.Name0./}}}});
      

      As you can see $elemMatch is nested into another $elemMatch. This query runs perfectly in shell.
      I have no clue how to translate it to C# as driver doesn't accept a filter without a name.
      I'm trying following code:

      Builders<BsonDocument>.Filter.ElemMatch ("Details.a", Builders<BsonDocument>.Filter.ElemMatch 
      (Builders<BsonDocument>.Filter.Regex(Builders<BsonDocument>.Filter.Regex
      ("DeviceName",new BsonRegularExpression("")))));
      

      No doubt, it didn't worked.
      I'm wondering if you guys have any plan to add support to driver to accept filters without name?

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: