Skip to main content

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)

Metadata

Release files for mongodex 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mongodex 0.0.1
File Size Uploaded Provenance
mongodex-0.0.1.tar.gz 5.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mongodex 0.0.1
File Interpreter ABI Platform
mongodex-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.1 kB

Release files / mongodex-0.0.1.tar.gz

Download URL mongodex-0.0.1.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e381aa3b9333594c2d8915fd290f945ec574aa8668d1f96932eb39f3cccd576a
BLAKE2b-256 checksum
How to use checksums
454e8ee05795742b9ec6b84c69313b6d467234b0c74e16a99a6c6a51e35281cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.2

Release files / mongodex-0.0.1-py3-none-any.whl

Download URL mongodex-0.0.1-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
25e6877f6973c8469c5ba3327baae539acca48ba42a01b12da45ca3572577319
BLAKE2b-256 checksum
How to use checksums
fccec29ab81ea4c945efbedfcaed795d782a6f591a81836e4423954ef0030af8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.2

Security for mongodex 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page