I am building a REST Api on Flask + MongoDB for a HR website. I need to filter search results by programming language, experience, city etc.
I also have a filter 'framework'. But I also need to implement an additional framework filter which is "nice to have, but not necessary" I just need to sort the items order including the additional framework.
The framework itself is listed in the 'about' field as a string, so I am using a regex to find it.
For example, I am looking for a Python developer who must have a Flask knowledge, but it is nice to know React too. So I need to have a search result like this:
- Dev A: Python, Flask, React
- Dev B: Python, Flask, React
- Def C: Python, Flask
The problem is that this second framework is not mandatory, when the first is so I can't query with '$or' or '$in'. The only option I see is that I query for the first framework and then sort it by presence of the second framework.
Is there a way to implement it in MongoDB?