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

Add string & IEnumerable overloads for SearchDefinitionBuilder.Equals

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Atlas Search
    • None
    • Dotnet Drivers

      Currently Equals is limited to struct, IComparable which excludes strings

      public SearchDefinition<TDocument> Equals<TField>(
          FieldDefinition<TDocument, TField> path,
          TField value,
          SearchScoreDefinition<TDocument> score = null)
          where TField : struct, IComparable<TField> =>
              new EqualsSearchDefinition<TDocument, TField>(path, value, score);

      Since Atlas Search now supports equals operator on token types, an overload with the string type would be useful.

       

      Also, overloads for IEnumerable<TField> on equals would also be nice to have since equals also supports array fields, so we can do this

      Builders<A>.Search.Equals(x => x.IntArray, 1)
      Builders<A>.Search.Equals(x => x.StringArray, "")

            Assignee:
            boris.dogadov@mongodb.com Boris Dogadov
            Reporter:
            venkat.guru@onepeloton.com Venkat Guru
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: