Testing a filter on a document on client-side

后端 未结 2 801
迷失自我
迷失自我 2021-01-27 20:33

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

相关标签:
2条回答
  • 2021-01-27 20:51

    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.

    0 讨论(0)
  • 2021-01-27 20:51

    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)
        """
        ...
    
    0 讨论(0)
提交回复
热议问题