Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 Mongodb 和 Mongoid 作为映射器。例如在 Active-record 我们使用 rake db:migrate 来迁移和创建数据库。monogoid 的命令是什么,以便在模型中声明的集合在本地 mongo 数据库中创建。
MongoDB 是一个没有模式的 NoSQL 数据库(同一集合中的文档在内容方面可能不同)。因此,当您更改内容或添加新字段或删除 ODM 中的现有字段时,您无需进行数据库迁移。即使您不需要运行 db:migrate 任务来创建集合。它是根据您的要求创建的。就像将数据序列化为二进制文件 (BSON) 一样简单。