{"id":20021580,"url":"https://github.com/nimeshkverma/mongo_schema","last_synced_at":"2025-05-05T01:30:56.920Z","repository":{"id":57442981,"uuid":"42947162","full_name":"nimeshkverma/mongo_schema","owner":"nimeshkverma","description":"Python Package to provide a rough schema for the mongodb collection","archived":false,"fork":false,"pushed_at":"2020-04-12T10:17:12.000Z","size":26,"stargazers_count":12,"open_issues_count":4,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-08T14:45:50.105Z","etag":null,"topics":["mongodb-collections","mongoschema","pip","python","schema","schema-information","stats"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nimeshkverma.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-22T16:44:15.000Z","updated_at":"2022-07-21T04:03:12.000Z","dependencies_parsed_at":"2022-09-04T23:00:42.373Z","dependency_job_id":null,"html_url":"https://github.com/nimeshkverma/mongo_schema","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimeshkverma%2Fmongo_schema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimeshkverma%2Fmongo_schema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimeshkverma%2Fmongo_schema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimeshkverma%2Fmongo_schema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nimeshkverma","download_url":"https://codeload.github.com/nimeshkverma/mongo_schema/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252411773,"owners_count":21743603,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mongodb-collections","mongoschema","pip","python","schema","schema-information","stats"],"created_at":"2024-11-13T08:37:16.998Z","updated_at":"2025-05-05T01:30:56.648Z","avatar_url":"https://github.com/nimeshkverma.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mongoschema\n**MongoDB schema information in Python**\n\n**mongoschema** is a library written in Python to provide concise description of the schema of a collection in MongoDB\n\n\n\n## Installation\n***\nTo install the package, type the following -\n\n\tpip install mongoschema\n\n\n## Sample data - Populating MongoDB with sample data\n***\nNavigate to `test/sample_data` in the `mongojoin` directory and type the following command -\n\n\t\u003e mongoimport --dbname test --collection supplier --file supplier.json\n\t\u003e mongoimport --dbname test --collection order --file order.json\n\nThis will create and populate the required collections with sample data.\n\n\nThe two collections *supplier* and *order* will be used to demonstrate how to use **mongoschema**.\nTo check the contents of the collection, the following command can be used in the MongoDB shell :\n\n\t\u003e use test\n\t\u003e db.supplier.find({})\n\t\u003e db.order.find({})\n\n## Using `mongoschema` to get the schema information of a MongoDB collections\n***\nType the following in Python shell to import `mongoschema`- \n\n\t\u003e\u003e\u003e from mongoschema import Schema\n\nTo create a `Schema` object for the collection to be analysed, type the following -\n\n\t\u003e\u003e\u003e schema = Schema(\"test\", \"supplier\")\n\nwhere `test` is the DB name and `supplier` is the Collection name.\n\n\nAdditional parameters -\n`host` : Mongo uri (String)\n`port` : Port Number (Integer)\n`limit`: Number of docs to be sampled\n\nTo get the stats of the collection -\n\n\t\u003e\u003e\u003e num_docs, result = schema.get_schema()\n\n`num_docs`: Total number of docs sampled\n`result`  : Dictionary containing the stats\n\nUse the following command to pretty print the results -\n\n    \u003e\u003e\u003e schema.print_schema()\n\n\n    +-------------+------------------+-----------------------+------------------+-----------------------+\n\t|   Key       | Occurrence Count | Occurrence Percentage |    Value Type    | Value Type Percentage |\n\t+-------------+------------------+-----------------------+------------------+-----------------------+\n\t| supplier_id |        7         |         100.0         |   \u003ctype 'int'\u003e   |         100.0         |\n\t|     name    |        7         |         100.0         | \u003ctype 'unicode'\u003e |         100.0         |\n\t|     _id     |        7         |         100.0         |      other       |         100.0         |\n\t+-------------+------------------+-----------------------+------------------+-----------------------+\n\nMore contents here - https://pypi.python.org/pypi/mongoschema/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnimeshkverma%2Fmongo_schema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnimeshkverma%2Fmongo_schema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnimeshkverma%2Fmongo_schema/lists"}