[CSHARP-4928] Add support for custom operators to SearchDefinitionBuilder Created: 09/Jan/24  Updated: 18/Jan/24  Resolved: 18/Jan/24

Status: Closed
Project: C# Driver
Component/s: Atlas Search, Builders
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Unknown
Reporter: Fred Morel Assignee: Boris Dogadov
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CSHARP-4927 Add support for Atlas Search $in oper... Closed
Documentation Changes Summary:

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?


 Description   

While https://jira.mongodb.org/browse/CSHARP-4927 isn't done (and any future added operators to Atlas Search), it would be helpful to have a "Custom" operator method on SearchDefinitionBuilder that takes

  • string operatorName
  • BsonDocument properties

and adds it to the SearchDefinition in the Filter/Must/etc as desired so we don't have to convert our entire query to BsonDocument or a JSON string.

It would make later migration to official helpers more easy.



 Comments   
Comment by Boris Dogadov [ 18/Jan/24 ]

The requested functionality exists.

Comment by Fred Morel [ 17/Jan/24 ]

You can close this as Not Implementing or whatever equivalent this board uses.

Comment by Boris Dogadov [ 17/Jan/24 ]

Hi fred.morel@onepeloton.com,

Thanks for the update. You could also use JsonSearchDefinition if needed.

Comment by Fred Morel [ 09/Jan/24 ]

Right after I created this ticket, I realized I could do this:

var definition = new SearchDefinitionBuilder<MyType>().Compound();
definition.Filter(new BsonDocumentSearchDefinition<MyType>(new BsonDocument
{
["$in"] = /* path + values */
}));

Comment by PM Bot [ 09/Jan/24 ]

Hi fred.morel@onepeloton.com, thank you for reporting this issue! The team will look into it and get back to you soon.

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