Project description
mongodex
Mongodex is a Python library to migrate your MongoDB database indexes.
Installation
pip install mongodex
How to use
To migrate your indexes to a MongoDB database, you need to create a dictionary that contains each collection index. The indexes must be a mongodex.Index
instance. For example:
from pymongo import ASCENDING , DESCENDING
import mongodex
collections = {
"<COLLECTION_NAME>" : [
mongodex . Index ({ "<FIELD_NAME>" : ASCENDING }, unique = True ),
mongodex . Index ({ "<FIELD_NAME>" : ASCENDING , "<FIELD_NAME>" : ASCENDING }),
],
"<COLLECTION_NAME>" : [
mongodex . Index ({ "<FIELD_NAME>" : DESCENDING }, name = "custom_index_name" ),
]
}
Then you can migrate your indexes by calling the mongodex.migrate
function with your database URI.
mongodex . migrate ( "<DATABASE_URI>" , collections )
Markdown docs generator
You can also create a markdown file with all your indexes using the same collection index dictionary mentioned in the previous topic. For example:
mongodex . md_generator ( collections )
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages .
Source Distribution
Built Distribution
File details
Details for the file mongodex-0.0.1.tar.gz
.
File metadata
Download URL:
mongodex-0.0.1.tar.gz
Upload date: Aug 18, 2022
Size: 5.1 kB
Tags: Source
Uploaded using Trusted Publishing? No
Uploaded via: twine/4.0.1 CPython/3.10.2
File hashes
Hashes for mongodex-0.0.1.tar.gz
Algorithm
Hash digest
SHA256
e381aa3b9333594c2d8915fd290f945ec574aa8668d1f96932eb39f3cccd576a
Copy
MD5
55bcad755de1937d1b78a8cee5ec06bf
Copy
BLAKE2b-256
454e8ee05795742b9ec6b84c69313b6d467234b0c74e16a99a6c6a51e35281cc
Copy
See more details on using hashes here.
File details
Details for the file mongodex-0.0.1-py3-none-any.whl
.
File metadata
Download URL:
mongodex-0.0.1-py3-none-any.whl
Upload date: Aug 18, 2022
Size: 5.9 kB
Tags: Python 3
Uploaded using Trusted Publishing? No
Uploaded via: twine/4.0.1 CPython/3.10.2
File hashes
Hashes for mongodex-0.0.1-py3-none-any.whl
Algorithm
Hash digest
SHA256
25e6877f6973c8469c5ba3327baae539acca48ba42a01b12da45ca3572577319
Copy
MD5
f8b8567c24d7d3ea1e4fcc6c66868311
Copy
BLAKE2b-256
fccec29ab81ea4c945efbedfcaed795d782a6f591a81836e4423954ef0030af8
Copy
See more details on using hashes here.