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

Add string & IEnumerable overloads for SearchDefinitionBuilder.Equals

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

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      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: