Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django : Using Mongodb with django [closed]

I just start looking at mongo db for the Django backend.

I have few questions .

1.Can i use raw mongo db instead os using Django ORM for the queryset .

2.My application is realted to Electronic health record so somone can add many details somone will not add anything (Basicaaly it should not database field dependent .)Please help me in this case how should I Design my Model . Or Instead of using Model can I directly fetch and data using raw mongo db queries from the Django view ?

I go through some blog post and found it is working somewhat ok .
But . Can I insert some field in the database which is not defined in the Django Model .

Really confuse .

Any help and suggestionn would be appriciated .

like image 399
masterofdestiny Avatar asked Mar 12 '13 10:03

masterofdestiny


People also ask

Does Django work well with MongoDB?

Django, the most popular Python web framework, is an ideal tool to build secure and easy-to-maintain applications using MongoDB. Using MongoDB with Django is advantageous because: Every second, more and more unstructured data is generated from various sources like chats, real-time streams, feeds, and surveys.

How does Django save data in MongoDB?

First, we setup Django Project with a MongoDB Connector. Next, we create Rest Api app, add it with Django Rest Framework to the project. Next, we define data model and migrate it to the database. Then we write API Views and define Routes for handling all CRUD operations (including custom finder).

Can we use NoSQL database with Django?

NoSQL databases are not officially supported by Django itself. There are, however, a number of side projects and forks which allow NoSQL functionality in Django.


1 Answers

There are various framework you can adopt when you want to use MongoDB for Django. Listed are some of the framework you might consider.

  • mongoengine
  • django-mongodb-engine
  • Ming
  • MongoKit

You can use directly access MangoDB without going through Django ORM, however it is better to use proper interface. Wrappers like PyMango and Ming enables you to take the advantage of dynamic behavior and provides a API to guarante of the type of data in a collection.

Selecting a framework will help you develop in confidence.

PyMango is a light weight wrapper and would provide you faster execution. However if you are looking for an ORM then MongoEngine or MongoKit or Ming.

like image 150
Pravin Avatar answered Oct 07 '22 03:10

Pravin