rupamsau_0010
rupamsau_0010

Reputation: 31

How to connect Django 3.1 to MongoDB

I am working with Django 3.1 edition. As a Database, my choice is to go with any NoSQL database like MongoDB. I have tried two ways to connect MongoDB with Django 3.1. First One is using Djongo and the Second one is using Mongo Engine. But both the cases, I am unable to work with Django 3.1. In the case of Django, it's not supporting Django 3.1 but it switching me to Django 3.0.5, and in the case of mongo engine it's not supporting Django 3.1. Is there any third way to connect MongoDB with Django 3.1. Note that I have to use Django 3.1 only

These are the docs I was following in Djongo and Mongo Engine.

https://pypi.org/project/djongo/

https://django-mongodb-engine.readthedocs.io/en/latest/topics/setup.html

Upvotes: 2

Views: 683

Answers (1)

FlipperPA
FlipperPA

Reputation: 14311

Your best bet is going to be Djongo:

https://github.com/nesdis/djongo/

However, Djongo's master branch currently supports up to Django 3.0.5. If you really need Django 3.1 support:

Then see if it works, and what needs fixing. If you fix things in Djongo, you can send Pull Requests to the project for 3.1 support.

Please note, this is a fairly risky dependency to put into a project. You'll be locked to using versions of Django that Djongo supports going forward, and won't be able to upgrade until Djongo does. I've had to do this in some of my projects with third-party SQL Server support, and it can be frustrating. I wouldn't recommend it if you aren't comfortable getting involved with the project you're relying on, and contributing. That said... good luck!

Upvotes: 2

Related Questions