我大量使用 PHP/mySQL/CodeIgniter,编写 sql 语句来处理/操作数据。我觉得做这一切都很原始,而且我听说过关于 MongoDB、无模式数据库的好消息。
在 MySQL 中,模式可以帮助我找出模型的结构。通常,我会画出一个包含基本内容的类图:id、title、description、date
让我大吃一惊的是,MongoDB 看起来非常简单,很难把握从哪里开始。从我听到/读到的,它没有模式。我怎么知道它会返回什么类型?
如何构建模型,如何在不同“表”之间添加关系?
添加关系和映射数据的标准方法是什么?我试过玩它,但不确定我的做法是否正确。
我尝试阅读手册等,但找不到帮助我从 mySQL 过渡到 MongoDB 的好文章。
有没有我可以看到模型与 mySQL 和 MongoDB 的比较?像 CRUD 这样简单的东西。
我该如何开始,从哪里开始?
最佳答案
你可以开始 here .
How do I build my models, how do I add relations between different "tables"?
A non-relational approach is the best path to database solutions which scale horizontally to > many machines.
MongoDB stores data in JSON documents (which we serialize to BSON). JSON provides us a rich data model that seamlessly maps to native programming language types, and since its schema-less, makes it much easier to evolve your data model than with a system with enforced schemas such as a RDBMS.
也请查看 What is NoSQL, how does it work, and what benefits does it provide? , I need an advice about NoSQL/MongoDb and data/models structure和 Converting simple MySQL database to a NoSQL solution
关于php - 我需要介绍 MongoDB/NoSQL 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8676895/