Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for MongoDB Atlas $search operator #1989

Open
3 tasks done
mtrezza opened this issue Aug 8, 2023 · 5 comments
Open
3 tasks done

Add support for MongoDB Atlas $search operator #1989

mtrezza opened this issue Aug 8, 2023 · 5 comments
Labels
bounty:$100 Bounty applies for fixing this issue (Parse Bounty Program) type:feature New feature or improvement of existing feature

Comments

@mtrezza
Copy link
Member

mtrezza commented Aug 8, 2023

New Feature / Enhancement Checklist

Current Limitation

Parse JS SDK already provides support for the MongoDB $text operator, but not the MongoDB Atlas (hosted MongoDB) specific $search operator, or Atlas Search.

Feature / Enhancement Description

Add support for the MongoDB Atlas $search operator. Note that this operator is a header operator for multiple sub-operators, such as $regex.

Example Use Case

Search with regex using MongoDB Atlas Search.

Alternatives / Workarounds

Using the MongoDB driver directly via the Parse Server database adapter.

@parse-github-assistant
Copy link

parse-github-assistant bot commented Aug 8, 2023

Thanks for opening this issue!

  • 🎉 We are excited about your ideas for improvement!

@mtrezza mtrezza added type:feature New feature or improvement of existing feature bounty:$100 Bounty applies for fixing this issue (Parse Bounty Program) bounty:$250 Bounty applies for fixing this issue (Parse Bounty Program) and removed bounty:$100 Bounty applies for fixing this issue (Parse Bounty Program) bounty:$250 Bounty applies for fixing this issue (Parse Bounty Program) labels Aug 8, 2023
@mtrezza mtrezza pinned this issue Aug 8, 2023
@abdullateef97
Copy link
Contributor

@mtrezza can I take a look at this issue

@mtrezza
Copy link
Member Author

mtrezza commented Oct 6, 2024

@abdullateef97 Sure, please go ahead.

@harshbhar0629
Copy link

harshbhar0629 commented Oct 8, 2024

Example: Search with Regex Using MongoDB Atlas Search in Parse
FixMongoError

Example Use Case

  • The main use case is when a developer needs to perform a search with regex using MongoDB Atlas Search to match patterns within the data stored in MongoDB Atlas, which would typically require the $search operator. This enhancement would allow:
  • Searching for documents with field values that match a specific regex pattern.
  • Using Atlas Search's advanced text indexing and search functionalities for optimized performance and ranking of results.

Proposal for Parse SDK Enhancement

  • To make MongoDB Atlas $search available within Parse's aggregate() function, the following actions would be required:
  • Update Parse Server to support the MongoDB $search operator within the aggregation pipeline.
  • Modify Parse Query Methods to recognize and handle the $search operator and its sub-operators like $regex, $text, autocomplete, etc.
  • Ensure backward compatibility so that existing code using $text searches or other MongoDB operators continues to work seamlessly.

@mtrezza Please review it once:)

@mtrezza
Copy link
Member Author

mtrezza commented Oct 8, 2024

The main use case is when a developer needs to perform a search with regex using MongoDB Atlas Search to match patterns within the data stored in MongoDB Atlas, which would typically require the $search operator.

This feature is not tailored to any specific use case. The $search operator should simply be accepted in Parse Server's aggregation pipeline query validation. How $search is used (text, geo points, etc.) is up to the developer. If I'm not mistaken then there isn't much validation needed, aside from allowing the key $search. We don't (want to) validate the value of that key, as I think we also don't currently do that with other key values in the pipeline.

To make MongoDB Atlas $search available within Parse's aggregate() function, the following actions would be required:
...
Modify Parse Query Methods to recognize and handle the $search operator and its sub-operators like $regex, $text, autocomplete, etc.
Ensure backward compatibility so that existing code using $text searches or other MongoDB operators continues to work seamlessly.

Aggregate is only available via Cloud Code, not via any Parse client SDK, except the Parse JS SDK when used within the Cloud Code environment, since it's leading a double life as component of Parse Server. I do not believe that there is any validation currently on the Parse SDK side, only server side. If that is correct, then the Parse JS SDK shouldn't require any changes. That is all just off the top of my head, I haven't looked into the code. If you find any Parse JS SDK specific changes that may make sense, then let's discuss.

I believe we should add support for $searchMeta as well, since they both are related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bounty:$100 Bounty applies for fixing this issue (Parse Bounty Program) type:feature New feature or improvement of existing feature
Projects
None yet
Development

No branches or pull requests

3 participants