{ "info": { "author": "Olivier Carrere", "author_email": "olivier.carrere@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Utilities" ], "description": "==========\nmongoquery\n==========\n\n.. image:: https://travis-ci.org/kapouille/mongoquery.svg?branch=master\n :target: https://travis-ci.org/kapouille/mongoquery\n\nA utility library that provides a `MongoDB `_-like query\nlanguage for querying python collections. It's mainly intended to parse objects\nstructured as fundamental types in a similar fashion to what is produced by `JSON`\nor `YAML` parsers. It follows the specification of queries for MongoDB version 3.4.\n\n\n-----\nUsage\n-----\n\nExample:\n\n.. code-block:: python\n\n from mongoquery import Query, QueryError\n\n records = [\n {\"a\": 5, \"b\": 5, \"c\": None},\n {\"a\": 3, \"b\": None, \"c\": 8},\n {\"a\": None, \"b\": 3, \"c\": 9},\n {\"a\": 1, \"b\": 2, \"c\": 3},\n {\"a\": 2, \"c\": 5},\n {\"a\": 3, \"b\": 2},\n {\"a\": 4},\n {\"b\": 2, \"c\": 4},\n {\"b\": 2},\n {\"c\": 6}\n ]\n\n a_is_3 = Query({\"a\": 3})\n\n # match a single object\n matched = a_is_3.match(records[1])\n assert matched\n\n matched = a_is_3.match(records[0])\n assert not matched\n\n # filter elements\n filtered = filter(\n a_is_3.match,\n records\n )\n assert filtered == [records[1], records[5]]\n\n # incorrect filters raise QueryError\n try:\n matched = query({\"$foo\": 2}).match(records[1])\n except QueryError:\n pass # => \"$foo\" operator isn't supported\n\n\n------------\nQuery syntax\n------------\n\nThe syntax of queries matches closely the one of\n`MongoDB queries `_,\nand translates it to python using the following rules:\n\n - operators and field identifiers are expressed as strings. For instance,\n the following MongoDB query:\n\n .. code-block:: javascript\n\n {\n memos: {\n $elemMatch: {\n memo: 'on time',\n by: 'billing'\n }\n }\n }\n\n Translates straightforwardly to the following Python dict:\n\n .. code-block:: python\n\n {\n \"memos\": {\n \"$elemMatch\": {\n \"memo\": 'on time',\n \"by\": 'billing'\n }\n }\n }\n\n - regular expressions are expected to be expressed as string containing\n the MongoDB regular expression syntax. For instance:\n\n .. code-block:: javascript\n\n {description: {$regex: /^S/m}}\n\n Translates to the following Python dict:\n\n .. code-block:: python\n\n {\"description\": {\"$regex\": \"/^S/m\"}}\n\n - the boolean, null syntax used in MongoDB follows the JavaScript syntax.\n It is expected the python equivalents are used. For instance:\n\n .. code-block:: javascript\n\n {a: {$exists: true}, b: null}\n\n Translates to the following Python dict:\n\n .. code-block:: python\n\n {\"a\": {\"$exists\": True}, \"b\": None}\n\n\n---------------------------------------------\nFunctional differences with MongoDB's queries\n---------------------------------------------\n\nThere are a few features that are not supported by ``mongoquery``:\n - Only the ``\"/pattern/\"`` syntax is supported for ``$regex``. As\n a consequence, ``$options`` isn't supported.\n - ``$text`` hasn't been implemented.\n - Due to the pure python nature of this library, ``$where`` isn't supported.\n - The `Geospatial` operators ``$geoIntersects``, ``$geoWithin``,\n ``$nearSphere``, and ``$near`` are not implemented.\n - Projection operators `$``, ``$elemMatch``, ``$meta``, and ``$slice`` are\n not implemented (only querying is implemented)\n - ``$type`` is limited to recognising generic python types, it won't look\n into recognising the format of the data (for instance, it doesn't check\n Object ID's format, only that they are strings)\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/kapouille/mongoquery", "keywords": "mongodb query match", "license": "", "maintainer": "", "maintainer_email": "", "name": "mongoquery", "package_url": "https://pypi.org/project/mongoquery/", "platform": "", "project_url": "https://pypi.org/project/mongoquery/", "project_urls": { "Homepage": "http://github.com/kapouille/mongoquery" }, "release_url": "https://pypi.org/project/mongoquery/1.3.5/", "requires_dist": [ "six" ], "requires_python": "", "summary": "A utility library that provides a MongoDB-like query language for querying python collections. It's mainly intended to parse objects structured as fundamental types in a similar fashion to what is produced by JSON or YAML parsers.", "version": "1.3.5" }, "last_serial": 4376883, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "8b2cec5bdff7d107acfa3185eb16f7a6", "sha256": "118f0d96b14738278edc308ca9efcfd27ebf63ea9413a6b161c4169fabca5d42" }, "downloads": -1, "filename": "mongoquery-0.1.1-py2-none-any.whl", "has_sig": false, "md5_digest": "8b2cec5bdff7d107acfa3185eb16f7a6", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6502, "upload_time": "2015-01-05T16:13:20", "url": "https://files.pythonhosted.org/packages/c5/18/e3ae16cbeb6840668a585296dd85c32f29f152b7bfc508bd07b5521331e5/mongoquery-0.1.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ca9d282d3b825be2e5b92f64cb928fde", "sha256": "7663563b413c027808eebebbb33c346037273d81ed32ae7cba1b364d36a55c58" }, "downloads": -1, "filename": "mongoquery-0.1.1.tar.gz", "has_sig": false, "md5_digest": "ca9d282d3b825be2e5b92f64cb928fde", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4477, "upload_time": "2015-01-05T16:13:23", "url": "https://files.pythonhosted.org/packages/27/46/b079e2fd64c60fb398149df462252c6c2a889ce6f8839ca9212092504e9f/mongoquery-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "2b7d649cf5ea495ae9105cd0a39ffdd5", "sha256": "263d583d65f21c7374462b26132df0d51ad28d16121260102abfc76cbe500ffc" }, "downloads": -1, "filename": "mongoquery-0.1.2-py2-none-any.whl", "has_sig": false, "md5_digest": "2b7d649cf5ea495ae9105cd0a39ffdd5", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6511, "upload_time": "2015-01-05T16:39:41", "url": "https://files.pythonhosted.org/packages/bb/94/aaaa585f42855e6ffa8d55f6838584f793e579aa0af8ef3fa3718248c1ab/mongoquery-0.1.2-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1c9a456f2f8d32f6e81d7632fe9843aa", "sha256": "ad91a4f79a56ca76be4986c2a80ee3e53c212243ed39b1df4d1039398e33233b" }, "downloads": -1, "filename": "mongoquery-0.1.2.tar.gz", "has_sig": false, "md5_digest": "1c9a456f2f8d32f6e81d7632fe9843aa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4486, "upload_time": "2015-01-05T16:39:44", "url": "https://files.pythonhosted.org/packages/0e/22/3c892f3ff6a19b57e8c89a6ea21ff6833385af327d814737170bbe42fdb7/mongoquery-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "5e11d77a4f7d7f897483ea384466b152", "sha256": "e8e0df2d3de65bf0cb2d4a17f4930b0491cd309d0411edaf5ed419f36f682ce6" }, "downloads": -1, "filename": "mongoquery-0.1.3.tar.gz", "has_sig": false, "md5_digest": "5e11d77a4f7d7f897483ea384466b152", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4640, "upload_time": "2015-11-04T15:58:49", "url": "https://files.pythonhosted.org/packages/81/4a/59a7eff22333e72b77914c44f106535be82d34d43c0ca7da6b75c9ab89ca/mongoquery-0.1.3.tar.gz" } ], "1.0": [ { "comment_text": "", "digests": { "md5": "bb321fdfcc12d96b27febd5659c3146a", "sha256": "fef6a4434b9f8a2c7d1a883dae619ab9945299082c06551f188ea7f38e7f79d9" }, "downloads": -1, "filename": "mongoquery-1.0.tar.gz", "has_sig": false, "md5_digest": "bb321fdfcc12d96b27febd5659c3146a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4659, "upload_time": "2015-11-17T17:41:04", "url": "https://files.pythonhosted.org/packages/a3/a8/9b327fc49e44265792efd0ca1e8997d4e6e92d492abf4ab18bd4820a7c64/mongoquery-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "428a871125fe87a713e8e1c2ee36a40b", "sha256": "b43488501bd7b34f9ea8afb67e98937f0a7053809143672c322733ae59f148cc" }, "downloads": -1, "filename": "mongoquery-1.0.1.tar.gz", "has_sig": false, "md5_digest": "428a871125fe87a713e8e1c2ee36a40b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4680, "upload_time": "2016-01-22T13:58:52", "url": "https://files.pythonhosted.org/packages/78/a5/14f5830d64571e29df64f23d179156235a991cf7d8e02e93ff3792d41b77/mongoquery-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "9712b7ee87a55e18c13352242e5e37f8", "sha256": "24c8701625ed3eb96725b063c46f42cd12ad06ec61651e4f945417d357b52c55" }, "downloads": -1, "filename": "mongoquery-1.0.2.tar.gz", "has_sig": false, "md5_digest": "9712b7ee87a55e18c13352242e5e37f8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4730, "upload_time": "2016-03-30T14:48:45", "url": "https://files.pythonhosted.org/packages/e1/a8/2554ce28333375ad09f7b86b91a64dde921d4b5b7943e340149c5a2471e9/mongoquery-1.0.2.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "3eb2bd470065e46870d92a6206c3e09c", "sha256": "e638fb24efef390683128c0991e5c931fff5420757add452bd6e92f7a81176f6" }, "downloads": -1, "filename": "mongoquery-1.1.0.tar.gz", "has_sig": false, "md5_digest": "3eb2bd470065e46870d92a6206c3e09c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5008, "upload_time": "2016-05-17T14:04:35", "url": "https://files.pythonhosted.org/packages/bb/bf/f8fab11c73feccccf9fb1858b69a55fc2f7ff9cecdb8ae7b2c668bcfbf02/mongoquery-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "bd465ffcd66dbdc26b602abdc60e2ce9", "sha256": "2a996a0c78bd273e0be59b0592ce4f118b9db084c4920b58de1a1f94e837d06a" }, "downloads": -1, "filename": "mongoquery-1.2.0.tar.gz", "has_sig": false, "md5_digest": "bd465ffcd66dbdc26b602abdc60e2ce9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5958, "upload_time": "2017-08-02T10:53:13", "url": "https://files.pythonhosted.org/packages/81/3e/afe79ef123b3476a32e148b4ee1658b102f9edc510b89dcd19c006060eed/mongoquery-1.2.0.tar.gz" } ], "1.3.0": [ { "comment_text": "", "digests": { "md5": "482be003e87b169b3af12de6ced4afd1", "sha256": "381c092dafd6f36ab919e3a879ea60811394e46b77e652dc9b2927f2707d7b8b" }, "downloads": -1, "filename": "mongoquery-1.3.0.tar.gz", "has_sig": false, "md5_digest": "482be003e87b169b3af12de6ced4afd1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5963, "upload_time": "2017-09-15T09:22:40", "url": "https://files.pythonhosted.org/packages/de/88/9e6cc7edaa2160692777d7874bef293da03e6a21b99a15d347af59d65590/mongoquery-1.3.0.tar.gz" } ], "1.3.2": [ { "comment_text": "", "digests": { "md5": "a905b423e1b419f0299502e6e371a1d6", "sha256": "7c9ae8feeedd991f29134b255e821038d8e5753b04864eb3434a276df62ea804" }, "downloads": -1, "filename": "mongoquery-1.3.2.tar.gz", "has_sig": false, "md5_digest": "a905b423e1b419f0299502e6e371a1d6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6235, "upload_time": "2017-09-21T08:34:53", "url": "https://files.pythonhosted.org/packages/c4/f7/8e846756c1f0f436800274bd3e450366a885881e0ec9e54a778b34d384f3/mongoquery-1.3.2.tar.gz" } ], "1.3.3": [ { "comment_text": "", "digests": { "md5": "fd044f0485d458e2e9621eb25e33c00c", "sha256": "524c26f4ac3619f339b3011cfb7f5a0d929f33cd60f3afe36766217a266b820f" }, "downloads": -1, "filename": "mongoquery-1.3.3.tar.gz", "has_sig": false, "md5_digest": "fd044f0485d458e2e9621eb25e33c00c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6176, "upload_time": "2018-01-23T15:33:27", "url": "https://files.pythonhosted.org/packages/b3/e7/d4a50358d21b1f62cd78f677062d58912ccb29f3df265663c709c9dcd6f6/mongoquery-1.3.3.tar.gz" } ], "1.3.4": [ { "comment_text": "", "digests": { "md5": "20a9633ad5c4f527805211348257bd3a", "sha256": "3c498abdbb274138ae1e11d78a1a57a10ca06cd4744bab52ed6dd1001be80c6b" }, "downloads": -1, "filename": "mongoquery-1.3.4.tar.gz", "has_sig": false, "md5_digest": "20a9633ad5c4f527805211348257bd3a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6246, "upload_time": "2018-09-04T15:50:32", "url": "https://files.pythonhosted.org/packages/02/7f/e8a451ae6883222dcb6e6f1355d7b52d31bcc1f74cd8b6d7b1cb8de3a574/mongoquery-1.3.4.tar.gz" } ], "1.3.5": [ { "comment_text": "", "digests": { "md5": "dd71c25262cc9dc19c445ddd50ee89f9", "sha256": "1f50ea2e032eaf02cf88197724511d4c15051e9e6fedabcb60736c848c3278bf" }, "downloads": -1, "filename": "mongoquery-1.3.5-py3-none-any.whl", "has_sig": false, "md5_digest": "dd71c25262cc9dc19c445ddd50ee89f9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6082, "upload_time": "2018-10-15T09:21:33", "url": "https://files.pythonhosted.org/packages/27/d1/4070cd433b54c838e40aa766c8b8324084a53091db207a0db86eb7461f0c/mongoquery-1.3.5-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dd71c25262cc9dc19c445ddd50ee89f9", "sha256": "1f50ea2e032eaf02cf88197724511d4c15051e9e6fedabcb60736c848c3278bf" }, "downloads": -1, "filename": "mongoquery-1.3.5-py3-none-any.whl", "has_sig": false, "md5_digest": "dd71c25262cc9dc19c445ddd50ee89f9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6082, "upload_time": "2018-10-15T09:21:33", "url": "https://files.pythonhosted.org/packages/27/d1/4070cd433b54c838e40aa766c8b8324084a53091db207a0db86eb7461f0c/mongoquery-1.3.5-py3-none-any.whl" } ] }