MongoEngine/mongoengine

Support for TextSearch (MongoAtlas)

0ssigeno opened this issue · 0 comments

Hi guys! I have absolutely no idea if you even would consider this use case that at my Organization we were facing, but let me try anyway.

We are currently using MongoEngine in our codebase, and we are using MongoAtlas to manager our cluster.
Atlas Search was recently published, and we gave it a try, and as you all know, it is actually a lot faster than the normal search.
Now, since we have some query that are quite expensive, we decided to migrate pretty much all the query to Atlas Search. Unfortunately this would mean two things:

  • Rewrite all the current query in our codebase (meaning pain and suffering that I would gladly skip)
  • Have an even different syntax without all the currently checks that MongoEngine has implemented.

Now, to solve this use case, since we did not find any opensource solution that would solve it, we decide that doing the complicate things was actually more fun than doing the boring things: so we wrote a proxy, called AtlasQ, where its users can continue to use the MongoEngine syntax but they will be using the engine of Atlas Search. We have added come validity check in the inputs (you can call e method to ensure that the index exists and that all the fields are actually indexed, because my previous self debugged for too much time, and I do not want other people to share the same feelings); inputs and outputs of all the methods that mongoengine implemented (first(), filter(), aggregate(), count(), ...) have the same signatures.

If this proxy could be useful, if there are actually other organizations that could benefit from that, we could easily merge it inside the mongoengine repository with a little bit of tuning here there!