Use mongoDB(nosql) with django without changing django ORM

Gaurav Balyan
1 min readDec 31, 2017

--

MongoDB is an open-source document oriented database that provides high performance, high availability, and automatic scaling.

If you have already django ORM designed code with relational database and you want to use mongoDB database on exist ORM then it can be possible using djongo package.

What is djongo?

djongo is a SQL to mongodb query compiler. It translates a SQL query string into a mongoDB query document.

How is use djongo in django project?

Step 1. install djongo package

pip install djongo

Step 2. changes in setting.py

DATABASES = {
'default': {
'ENGINE': 'djongo',
'NAME': 'database name',
}`
}

Step 3. perform migrations command

./manage.py makemigrations

./manage.py migrate

Step 5. Fun with django admin!

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

Note- Suggestions for improvements or issues, please raise a git-hub issue ticket. For questions and clarifications regarding usage, please put it up on stackoverflow instead.

For any query please write in comment box.

Thank you.

--

--