Say I have a SON-document (typically fetched using a mongodb query, but not necessarily), and a query-filter expression (e.g. { \'x\': {\'$ne\': 5} }
), is there a c
MongoDB's matcher algorithm is written in C++. You'd need at least a partial rewrite of the matcher in Python, which does not, to my knowledge, exist.
I found this interesting mongomock project.
The filter_applies() functions seems to be it.
def filter_applies(search_filter, document):
"""
This function implements MongoDB's matching strategy over documents in the find()
method and other related scenarios (like $elemMatch)
"""
...