How do I configure mongoDB indexes in django-nonrel without using Models?

一笑奈何 提交于 2019-12-01 14:04:40

With MongoDB you don't need an extra step to predeclare the schema to "set up" collections. The document-oriented nature of MongoDB actually does not enforce a strict schema; documents within a collection may have different fields as needed. It's a different concept to get used to, but the collection will be created as soon as you start saving data to it.

Indexes can be added using pymongo's ensureIndex on a collection.

Similar to the collection creation on data insertion, a collection will also be created if it does not exist when an index is added.

An article that should help you get started: Using MongoDB with Django.

If you're new to MongoDB, you also might want to try the short online tutorial.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!