Skip to main content

DocumentDB/MongoDB backend for Django

Project description

DocumentDB/MongoDB backend for Django

This project, django-documentdb, is a fork of the original django-mongodb repository, which was developed and maintained by the MongoDB Python Team. The primary purpose of this fork is to enhance compatibility with AWS DocumentDB, a MongoDB-compatible database service provided by Amazon Web Services. To accommodate the differences between DocumentDB and MongoDB’s API support, specific adjustments have been implemented to ensure seamless functionality within DocumentDB.

We encourage users to provide feedback and report any issues as we continue to improve the library. You can share your thoughts, suggestions, or report problems on our GitHub Issues page

Documentation

For full documentation, including installation, configuration, etc. Please see https://django-documentdb.readthedocs.io/

Installation

To install django_documentdb, use one of the following methods:

Using pip

You can install django_documentdb with:

pip install django_documentdb

Using Poetry

If you're using Poetry to manage your dependencies, you can add django_documentdb to your project with:

poetry add django_documentdb

Notes on Django QuerySets

django-documentdb uses own QuerySet implementation (DocumentQuerySet) if you inherit your models from DocumentModel class.

Example:

from django_documentdb.models import DocumentModel
from django_documentdb import fields
from django.db import models


class TestModel(DocumentModel):
    _id = fields.ObjectIdAutoField(primary_key=True)
    text_value = models.CharField(max_length=100, null=True)
    number_value = models.FloatField(null=True)

    class Meta:
        db_table = "test_db"

Available options with DocumentQuerySet:

  • QuerySet.explain() supports the comment and verbosity options.

    Example: QuerySet.explain(comment="...", verbosity="...")

    Valid values for verbosity are "queryPlanner" (default), "executionStats", and "allPlansExecution".

  • DocumentQuerySet.index_hint(index_name) - allows to specify index hint for query.

Known issues and limitations

  • The following QuerySet methods aren't supported:

    • bulk_update()
    • dates()
    • datetimes()
    • distinct()
    • extra()
    • prefetch_related()
  • QuerySet.delete() and update() do not support queries that span multiple collections.

  • DateTimeField doesn't support microsecond precision, and correspondingly, DurationField stores milliseconds rather than microseconds.

  • The following database functions aren't supported:

    • Chr
    • ExtractQuarter
    • MD5
    • Now
    • Ord
    • Pad
    • Repeat
    • Reverse
    • Right
    • SHA1, SHA224, SHA256, SHA384, SHA512
    • Sign
    • TruncDate
    • TruncTime
  • The tzinfo parameter of the Trunc database functions doesn't work properly because MongoDB converts the result back to UTC.

  • When querying JSONField:

    • There is no way to distinguish between a JSON "null" (represented by Value(None, JSONField())) and a SQL null (queried using the isnull lookup). Both of these queries return both of these nulls.
    • Some queries with Q objects, e.g. Q(value__foo="bar"), don't work properly, particularly with QuerySet.exclude().
    • Filtering for a None key, e.g. QuerySet.filter(value__j=None) incorrectly returns objects where the key doesn't exist.
    • You can study the skipped tests in DatabaseFeatures.django_test_skips for more details on known issues.
  • Due to the lack of ability to introspect MongoDB collection schema, migrate --fake-initial isn't supported.

Forked Project

This project, django-documentdb, is a fork of the original django-mongodb library, which aimed to integrate MongoDB with Django. The fork was created to enhance compatibility with AWS DocumentDB, addressing the limitations of its API support while maintaining the core functionalities of the original library. We appreciate the work of the MongoDB Python Team and aim to build upon their foundation to better serve users needing DocumentDB integration.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_documentdb-0.0.9.tar.gz (51.3 kB view details)

Uploaded Source

Built Distribution

django_documentdb-0.0.9-py3-none-any.whl (54.6 kB view details)

Uploaded Python 3

File details

Details for the file django_documentdb-0.0.9.tar.gz.

File metadata

  • Download URL: django_documentdb-0.0.9.tar.gz
  • Upload date:
  • Size: 51.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for django_documentdb-0.0.9.tar.gz
Algorithm Hash digest
SHA256 f3a9541655aeec6ba0fbb4bb439fb0d7e8e997a8907d9fb4c9d58709cc5557c2
MD5 8d00077e31e1153a837d41b52ffa6c7e
BLAKE2b-256 7377c98a5fe684893574258c1ba8e91112bc6273e5a23d28afc9df19bfec81b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_documentdb-0.0.9.tar.gz:

Publisher: publish-package.yml on iYasha/django-documentdb

Attestations:

File details

Details for the file django_documentdb-0.0.9-py3-none-any.whl.

File metadata

File hashes

Hashes for django_documentdb-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 36ef3117c74811bad9a541f6fcde4133f46e65ee0b0c3611177a3039c31ed9e6
MD5 f822edf53afa934c49e95a4684310e97
BLAKE2b-256 eef97b360ab8a80ef964c1531ec1f02ddec948ed233f29530d5b03eba0c26368

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_documentdb-0.0.9-py3-none-any.whl:

Publisher: publish-package.yml on iYasha/django-documentdb

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page