{ "info": { "author": "Nimesh Kiran (supported ably by DrCricket)", "author_email": "nimesh.aug11@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: Django :: 1.7", "Framework :: IDLE", "Framework :: IPython", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: MacOS", "Operating System :: Microsoft", "Operating System :: Unix", "Programming Language :: Python :: 2.7" ], "description": ".. image:: https://codeclimate.com/github/nimeshkverma/mongo_joins/badges/gpa.svg\r\n :target: https://codeclimate.com/github/nimeshkverma/mongo_joins\r\n :alt: Code Climate\r\n\r\n**mongojoin** : Performs SQL-like Joins in MongoDB\r\n\r\nThis is an attempt to provide SQL-like joins to users of MongoDB, who fetch related data from different collections frequently, with a library to combine data from more than one collection\r\n\r\nMongoDB is a de-normalized database and does not offer methods to perform \u201cjoin\u201d action on collections.\r\n\r\nGitHub Link : https://github.com/nimeshkverma/mongo_joins \r\n\r\nFeel free to raise issues and contribute.\r\n\r\n**Installation:**\r\n\r\nTo install the package, type the following :\r\n\r\n **pip install mongojoin**\r\n\r\n\r\n**How to Use**\r\n\r\n1.Import the following in the Python Script/Shell\r\n\r\n >>> from mongojoin.mongojoin import MongoJoin, MongoCollection\r\n\r\n2.Create a MongoCollection object (One for each of the two collections to be joined)\r\n\r\n >>> collection = MongoCollection(\"db_name\",\"collection_name\",[\"collection_select_key_1\", \"collection_select_key_2\"], {filter_key : filter_value})\r\n\r\n\r\n**R_select_key1 , R_select_key2** : Key, Value pairs to be fetched after join\r\n\r\n**filter_key : filter_value** : Filters for aggregating data prior to performing Join\r\n\r\n3.Create a MongoJoin object to perform the join.\r\n\r\n\r\n >>> join_object = MongoJoin(collection_left, collection_right, [\"join_key_2\",\"join_key_2\"])\r\n\r\n**join_key_1** : Key on which join is to be performed\r\n**join_key_2** : Key on which join is to be performed\r\n\r\n\r\n4.All the join functions return a DefaultDict object\r\n\r\nTo perform inner join \r\n\r\n\t>>> result = join_object.inner()\r\n\r\nTo perform left-outer join\r\n\r\n\t>>> result = join_object.left_outer()\r\n\r\nTo perform right-outer join\r\n\r\n\t>>> result = join_object.right_outer()\r\n\r\nTo perform full-outer join\r\n\r\n\t>>> result = join_object.full_outer()\r\n\r\n\r\nExample:\r\n\r\n**To perform join on two collections: supplier and order on supplier_id with results having the keys: supplier_id, name and qty and condition supplier_id == 1001**\r\n\r\n\t>>> from mongojoin.mongojoin import MongoJoin\r\n\t>>> from mongojoin.mongojoin import\r\n\r\n\t>>> supplier = MongoCollection(\"test\", \"supplier\", [\"supplier_id\", \"name\"], {\"supplier_id\": 1001})\r\n\t>>> order = MongoCollection(\"test\", \"order\", [\"supplier_id\", \"qty\"], {\"supplier_id\": 1001})\r\n\r\n\t>>> aggregator = MongoJoin(supplier, order, [\"supplier_id\"])\r\n\r\n\t>>> inner_join_result \t\t= aggregator.inner()\r\n\t>>> left_outer_join_result \t= aggregator.left_outer()\r\n\t>>> right_outer_join_result\t= aggregator.right_outer()\r\n\t>>> full_outer_join_result \t= aggregator.full_outer()\r\n\r\nThis is equivalent to following sql query:\r\n\r\n*SELECT supplier.supplier_id, supplier.name, order.supplier_id, order.qty FROM supplier JOIN order ON supplier.supplier_id = order.supplier_id WHERE supplier.supplier_id = 1001 AND order.supplier_id = 1001*\r\n\r\n\r\nLet us know if you have any queries -\r\n\r\nnimesh.aug11@gmail.com\r\nutsav.tiwary2011@gmail.com", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/nimeshkverma/mongo_joins/tarball/1.0.0", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/nimeshkverma/mongo_joins", "keywords": "mongo,joins,aggregations", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "mongojoin", "package_url": "https://pypi.org/project/mongojoin/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/mongojoin/", "project_urls": { "Download": "https://github.com/nimeshkverma/mongo_joins/tarball/1.0.0", "Homepage": "https://github.com/nimeshkverma/mongo_joins" }, "release_url": "https://pypi.org/project/mongojoin/1.0.0/", "requires_dist": null, "requires_python": null, "summary": "Python library for performing joins on MongoDB collections", "version": "1.0.0" }, "last_serial": 1721573, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "f19403ee0bbb1ecc772ca8132f0838ba", "sha256": "30d1de129083c97075b14580a716fd3900f46711221a763aaabb5451fb84dd73" }, "downloads": -1, "filename": "mongojoin-1.0.0.tar.gz", "has_sig": false, "md5_digest": "f19403ee0bbb1ecc772ca8132f0838ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3856, "upload_time": "2015-09-12T09:23:21", "url": "https://files.pythonhosted.org/packages/a2/a5/1123cbd18853705065cc72be7ce17b123d6134fbe2a4184c779562f3df04/mongojoin-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f19403ee0bbb1ecc772ca8132f0838ba", "sha256": "30d1de129083c97075b14580a716fd3900f46711221a763aaabb5451fb84dd73" }, "downloads": -1, "filename": "mongojoin-1.0.0.tar.gz", "has_sig": false, "md5_digest": "f19403ee0bbb1ecc772ca8132f0838ba", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3856, "upload_time": "2015-09-12T09:23:21", "url": "https://files.pythonhosted.org/packages/a2/a5/1123cbd18853705065cc72be7ce17b123d6134fbe2a4184c779562f3df04/mongojoin-1.0.0.tar.gz" } ] }