简体   繁体   中英

What is the relationship between flask, mongokit, pymongo, flask-pymongo?

I am really new to Flask and MongoDB . I read the Flask documentation about MongoDB , and turns out I felt so confused that I did not know which one I need to install.

In Flask document, it says if you want to operate MongoDB , you should install Mongokit , yes I did, I build the user structure like document said, and save it, but it did not work, I look up into MongoDB shell, nothing stored there. So, i keep searching that I need Pymongo , and another document say that Flask-PyMongo is the bridge between MongoDB and Pymongo.

do I need to install all of them? what's their relationship, I need someone clear my head a little bit BTW, can I use SQLalchemy with MongoDB ? or I just use Mongokit whatever above.

From MongoKit documentation :

MongoKit is based on pymongo. As such, all of the pymongo API is exposed through MongoKit. If you don't find what you want in the MongoKit API, please take a look at pymongo's documenation. All the pymongo API is exposed via connection, database and collection so Connection, Database and Collection are wrappers around pymongo objects.

MongoKit is an Object Document Mapper (ODM)

And as specify here

MongoKit is a python module that brings a structured schema and validation layer on top of the great pymongo driver.

As mentioned in Flask-PyMongo documentation

Flask-PyMongo bridges Flask and PyMongo, so that you can use Flask's normal mechanisms to configure and connect to MongoDB.

Now:

Do I need to install all of them?

The answer is NO you can use either MongoKit or Flask-PyMongo

Can I use SQLalchemy with Mongodb?

The answer is NO Why? read this

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM