{ "info": { "author": "Jonathan Mackenzie", "author_email": "", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python" ], "description": "Import/Export Mongo Schema\n===================\nImport and export mongodb schemas **without** copying all the data. It will extract the following meta data about a mongo database:\n\n* Collections\n* Indexes\n* Cap sizes\n* Schema validators\n\nThe primary use case is when you have developed an application that uses mongodb, and want to setup a new instance with\nthe appopriate database layout. You can then provide a `config.json` file with your application and have this script\nsetup the database for you without the need for extra `ensureIndex` calls!\n\nThis data will be stored in a `json` file for a database that looks something like this:\n\n```json\n{\n \"databases\": {\n \"test\": {\n \"location\": {\n \"indexes\": [\n {\n \"name\": \"_id_\",\n \"keys\": [\n [\n \"_id\",\n 1\n ]\n ]\n },\n {\n \"name\": \"pos_2dsphere\",\n \"2dsphereIndexVersion\": 3,\n \"keys\": [\n [\n \"pos\",\n \"2dsphere\"\n ]\n ]\n },\n {\n \"name\": \"device_1_timestamp_1\",\n \"keys\": [\n [\n \"device\",\n 1\n ],\n [\n \"timestamp\",\n 1\n ]\n ]\n }\n ],\n \"options\": {}\n },\n \"users\": {\n \"indexes\": [\n {\n \"name\": \"_id_\",\n \"keys\": [\n [\n \"_id\",\n 1\n ]\n ]\n },\n {\n \"unique\": true,\n \"name\": \"username_idx\",\n \"keys\": [\n [\n \"username\",\n 1\n ]\n ]\n }\n ],\n \"options\": {\n \"validator\": {\n \"$jsonSchema\": {\n \"bsonType\": \"object\",\n \"required\": [\n \"username\",\n \"password\",\n \"level\"\n ],\n \"properties\": {\n \"username\": {\n \"bsonType\": \"string\",\n \"description\": \"must be a string and is required\"\n },\n \"level\": {\n \"bsonType\": \"string\",\n \"enum\": [\n \"user\",\n \"admin\",\n \"moderator\"\n ],\n \"description\": \"must be a string\"\n },\n \"password\": {\n \"bsonType\": \"string\",\n \"description\": \"must be a bcrypt password\",\n \"pattern\": \"^\\\\$2b\\\\$\\\\d{1,2}\\\\$[A-Za-z0-9\\\\.\\\\/]{53}$\"\n }\n }\n }\n },\n \"validationLevel\": \"strict\",\n \"validationAction\": \"error\"\n }\n },\n \"capped\": {\n \"indexes\": [\n {\n \"name\": \"_id_\",\n \"keys\": [\n [\n \"_id\",\n 1\n ]\n ]\n },\n {\n \"unique\": true,\n \"name\": \"key_1\",\n \"keys\": [\n [\n \"key\",\n 1\n ]\n ]\n }\n ],\n \"options\": {\n \"capped\": true,\n \"size\": 64000,\n \"max\": 5000,\n \"validator\": {\n \"$jsonSchema\": {\n \"bsonType\": \"object\",\n \"description\": \"Simple key value store\",\n \"required\": [\n \"key\",\n \"value\"\n ],\n \"properties\": {\n \"key\": {\n \"bsonType\": \"string\",\n \"maxLength\": 64.0,\n \"description\": \"the key value\"\n },\n \"value\": {\n \"bsonType\": \"string\",\n \"description\": \"the associated value\"\n }\n }\n }\n },\n \"validationLevel\": \"strict\",\n \"validationAction\": \"error\"\n }\n }\n }\n },\n \"exported\": \"2018-07-18T17:12:43.460992\"\n}\n```\n\nInstallation\n------------\n\n```bash\npip install MongoSchemaImportExport\n```\n\nUsage\n-----\nMake sure the user you are using to import/export has the appropriate privileges, they'll probably need to have the\n `root` role or `dbOwner` on the source and destination.\nTo export your data run:\n\n```bash\nmongo-schema-export.py --uri mongodb://user:password@database.host1.com:27017/admin --databases test2,testIgnore\n```\n\nTo import your schema run as bellow. Use `--delete-col` to delete collections before creating them (**WARNING:** this\n will delete your data, you cannot change \nan existing collection into a capped one, although, you can set a validator after creation):\n\n```bash\nmongo-schema-import.py --uri mongodb://user:password@database.host2.com:27017/admin --databases db_1,db_2 --verbose --delete-col\n```\nYou will get an output like this:\n\n```\nSkipping: testIgnore\nCreating database: test2\n\tDropping collection location\n\tCreating collection: location\n\t\tOptions {}\n\t\tCreating index: {'name': '_id_', 'keys': [['_id', 1]]}\n\t\tCreating index: {'name': 'pos_2dsphere', '2dsphereIndexVersion': 3, 'keys': [['pos', '2dsphere']]}\n\t\tCreating index: {'name': 'device_1_timestamp_1', 'keys': [['device', 1], ['timestamp', 1]]}\n\tDropping collection users\n\tCreating collection: users\n\t\tOptions {'validator': {'$jsonSchema': {'bsonType': 'object', 'required': ['username', 'password', 'level'], 'properties': {'username': {'bsonType': 'string', 'description': 'must be a string and is required'}, 'level': {'bsonType': 'string', 'enum': ['user', 'admin', 'moderator'], 'description': 'must be a string'}, 'password': {'bsonType': 'string', 'description': 'must be a bcrypt password', 'pattern': '^\\\\$2b\\\\$\\\\d{1,2}\\\\$[A-Za-z0-9\\\\.\\\\/]{53}$'}}}}, 'validationLevel': 'strict', 'validationAction': 'error'}\n\t\tCreating index: {'name': '_id_', 'keys': [['_id', 1]]}\n\t\tCreating index: {'unique': True, 'name': 'username_idx', 'keys': [['username', 1]]}\n\tDropping collection capped\n\tCreating collection: capped\n\t\tOptions {'capped': True, 'size': 64000, 'max': 5000, 'validator': {'$jsonSchema': {'bsonType': 'object', 'description': 'Simple key value store', 'required': ['key', 'value'], 'properties': {'key': {'bsonType': 'string', 'maxLength': 64.0, 'description': 'the key value'}, 'value': {'bsonType': 'string', 'description': 'the associated value'}}}}, 'validationLevel': 'strict', 'validationAction': 'error'}\n\t\tCreating index: {'name': '_id_', 'keys': [['_id', 1]]}\n\t\tCreating index: {'unique': True, 'name': 'key_1', 'keys': [['key', 1]]}\n\n```\n\n\nIf you get permission errors, make sure your user has the right roles to read and write databases and collections.\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jonnoftw/mongo_import_export_schema", "keywords": "pymongo mongodb schema import export", "license": "Creative Commons Attribution-Noncommercial-Share Alike license", "maintainer": "", "maintainer_email": "", "name": "MongoSchemaImportExport", "package_url": "https://pypi.org/project/MongoSchemaImportExport/", "platform": "", "project_url": "https://pypi.org/project/MongoSchemaImportExport/", "project_urls": { "Homepage": "https://github.com/jonnoftw/mongo_import_export_schema" }, "release_url": "https://pypi.org/project/MongoSchemaImportExport/0.2.4/", "requires_dist": null, "requires_python": "", "summary": "Import and export metadata about mongodb databases and collections", "version": "0.2.4" }, "last_serial": 4578581, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "c5926ecd154d2b3dab82222fe6132a64", "sha256": "d8106444a161416292f1d1ea01bd2b127eb0a5b05c961a3abf6944214625a1bc" }, "downloads": -1, "filename": "MongoSchemaImportExport-0.2-py2.7.egg", "has_sig": false, "md5_digest": "c5926ecd154d2b3dab82222fe6132a64", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 8717, "upload_time": "2018-11-28T01:50:41", "url": "https://files.pythonhosted.org/packages/d7/fe/5c956620bd307d929136db5969fba2b33da88997946e90ae1f1f88d40192/MongoSchemaImportExport-0.2-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "e7f5bb326740875d5ea66ce0be2135ee", "sha256": "dc760801f80cb412546c992eed56375dbf62c341f57a9a3ffa77090558825cd5" }, "downloads": -1, "filename": "MongoSchemaImportExport-0.2-py3.6.egg", "has_sig": false, "md5_digest": "e7f5bb326740875d5ea66ce0be2135ee", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 12777, "upload_time": "2018-11-28T01:50:43", "url": "https://files.pythonhosted.org/packages/20/6e/a22ff496d1446046a88836d214385ffdd9978a3b483855162c73761254ec/MongoSchemaImportExport-0.2-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "37c52dc255c6e75864336852c76e127d", "sha256": "64ceccfab9eadcd955d1f7fdbb183a5a9b1387fbacbbf8a676aff199197a184d" }, "downloads": -1, "filename": "MongoSchemaImportExport-0.2.tar.gz", "has_sig": false, "md5_digest": "37c52dc255c6e75864336852c76e127d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5172, "upload_time": "2018-07-19T05:55:02", "url": "https://files.pythonhosted.org/packages/dd/ab/3df1e39d5989549de2f1de1cef9cea709e1aeb14ee00b305d94200e17c11/MongoSchemaImportExport-0.2.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "df927290b78cbfd047e529f4b44562e5", "sha256": "0768db1950bc125f9c20cfe116342e2b72c845248bac8aa3de7d750ab767eb28" }, "downloads": -1, "filename": "MongoSchemaImportExport-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "df927290b78cbfd047e529f4b44562e5", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8953, "upload_time": "2018-11-28T01:50:36", "url": "https://files.pythonhosted.org/packages/d6/28/0ac4d1390039a2fb64c0deda2d851ffbcb2db8a5919a0800cfaa3853d4e1/MongoSchemaImportExport-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ef1e4772ed9c86612a16d76ee02bdf77", "sha256": "01aaef2ea78a1f80e5005584e75e81300d54135f9571c75557bed631bd8f8e65" }, "downloads": -1, "filename": "MongoSchemaImportExport-0.2.1.tar.gz", "has_sig": false, "md5_digest": "ef1e4772ed9c86612a16d76ee02bdf77", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5170, "upload_time": "2018-11-28T01:50:38", "url": "https://files.pythonhosted.org/packages/e6/aa/0ceb4e88b27cd8a7ebdb8acf0da99f1ff1bf218f8fd53ee74f523b3cf67b/MongoSchemaImportExport-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "d02bee3270600e71add3d9d01b6b818b", "sha256": "a8c4a2007b03e6174794b2dcc6ac6a85632beca4be4066ca948525949e843ba1" }, "downloads": -1, "filename": "MongoSchemaImportExport-0.2.2-py3-none-any.whl", "has_sig": false, "md5_digest": "d02bee3270600e71add3d9d01b6b818b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8968, "upload_time": "2018-11-28T01:54:18", "url": "https://files.pythonhosted.org/packages/35/86/9a7e62884acf0dff067a5c61f77074b8d4c572e43b7ab6178cc1834ee87f/MongoSchemaImportExport-0.2.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "568559adc61bdc554870b1c80f0c810a", "sha256": "0ff62b8300c6966366505d73029c4c1c3a0e2f2029f5e7935d30628d86ccbcef" }, "downloads": -1, "filename": "MongoSchemaImportExport-0.2.2.tar.gz", "has_sig": false, "md5_digest": "568559adc61bdc554870b1c80f0c810a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5204, "upload_time": "2018-11-28T01:54:21", "url": "https://files.pythonhosted.org/packages/b2/85/10f1d169c702fa0c983a8183f4c23cd043bc362807b339b1cc79b5ac73d4/MongoSchemaImportExport-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "693a2f6aa1b2c4ea4856804df93206e7", "sha256": "997f3a6ab97f3750a3d8ba0806e47f770efc18e6c70f5d84e7d23a6e41bc0089" }, "downloads": -1, "filename": "MongoSchemaImportExport-0.2.3-py3-none-any.whl", "has_sig": false, "md5_digest": "693a2f6aa1b2c4ea4856804df93206e7", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9036, "upload_time": "2018-12-03T03:17:33", "url": "https://files.pythonhosted.org/packages/f9/34/973ac242fa705e22b458256ce88b4d0ca447ddf164f8a251d1937f6c2cba/MongoSchemaImportExport-0.2.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ab75f2f3d945757b0a451d758dd7a463", "sha256": "1140807a1e4483740f6fc55d070b540b092978a2c3b32730b0de433120f6c60e" }, "downloads": -1, "filename": "MongoSchemaImportExport-0.2.3.tar.gz", "has_sig": false, "md5_digest": "ab75f2f3d945757b0a451d758dd7a463", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5253, "upload_time": "2018-12-03T03:17:36", "url": "https://files.pythonhosted.org/packages/57/81/39c266dc3a07f4641ffe010f84d5c050051f062a461cdad01664778f0992/MongoSchemaImportExport-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "74b6d2c37dc7b3e577e1e1b5f582042e", "sha256": "400b98eb8c12b85db1eb824ba429a59d205edc594fca08f25846e45c1ae7a5a1" }, "downloads": -1, "filename": "MongoSchemaImportExport-0.2.4-py3-none-any.whl", "has_sig": false, "md5_digest": "74b6d2c37dc7b3e577e1e1b5f582042e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9148, "upload_time": "2018-12-10T02:00:03", "url": "https://files.pythonhosted.org/packages/ba/9c/4eb67b50ab910f9ee7689546020000040838a35f65078c478f1f8830bc5e/MongoSchemaImportExport-0.2.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "aa36c4573634eba88f6089850549c77c", "sha256": "35ab0fe5d096d3e69dc93d9fc79cdf2a9f2b61a78587b8b0b199a56ac2e5ea96" }, "downloads": -1, "filename": "MongoSchemaImportExport-0.2.4.tar.gz", "has_sig": false, "md5_digest": "aa36c4573634eba88f6089850549c77c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5301, "upload_time": "2018-12-10T02:00:05", "url": "https://files.pythonhosted.org/packages/a7/8f/91d96fee63dd0d8b016572042b905df7acb2ea1004834906f4743c87a6db/MongoSchemaImportExport-0.2.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "74b6d2c37dc7b3e577e1e1b5f582042e", "sha256": "400b98eb8c12b85db1eb824ba429a59d205edc594fca08f25846e45c1ae7a5a1" }, "downloads": -1, "filename": "MongoSchemaImportExport-0.2.4-py3-none-any.whl", "has_sig": false, "md5_digest": "74b6d2c37dc7b3e577e1e1b5f582042e", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 9148, "upload_time": "2018-12-10T02:00:03", "url": "https://files.pythonhosted.org/packages/ba/9c/4eb67b50ab910f9ee7689546020000040838a35f65078c478f1f8830bc5e/MongoSchemaImportExport-0.2.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "aa36c4573634eba88f6089850549c77c", "sha256": "35ab0fe5d096d3e69dc93d9fc79cdf2a9f2b61a78587b8b0b199a56ac2e5ea96" }, "downloads": -1, "filename": "MongoSchemaImportExport-0.2.4.tar.gz", "has_sig": false, "md5_digest": "aa36c4573634eba88f6089850549c77c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5301, "upload_time": "2018-12-10T02:00:05", "url": "https://files.pythonhosted.org/packages/a7/8f/91d96fee63dd0d8b016572042b905df7acb2ea1004834906f4743c87a6db/MongoSchemaImportExport-0.2.4.tar.gz" } ] }