Django using PyMongo over Djongo

So, I’ve launched some newbie projects in Django 4 connecting to MySQL using ORM.
I want to know if its seamless like to do so using mongoDB for a new upcoming project using Django 4.0. (Not migrating from an existing one)

This tutorial shows how to use mongo with PyMongo. Is PyMongo preferred over Djongo ? Djongo seems to be the ORM used as in querying MySQL / Postgres.

Hi @anjanesh,

Core Django currently only supports SQL databases, so Djongo tries to work around that by transpiling SQL to equivalent MongoDB queries. There are some challenges with this approach and quite a few open Djongo issues that are worth reviewing before choosing your path.

Per the article you referenced, the recommended approach would be using PyMongo directly:

PyMongo is the standard driver through which MongoDB can interact with Django. It is the official and preferred way of using MongoDB with Python.

However, without direct support for MongoDB in Django I would personally be inclined to use a more lightweight approach like Flask with PyMongo (without any additional adapters or abstractions).

Regards,
Stennie

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.