【发布时间】:2017-11-12 19:07:58
【问题描述】:
Mongoose 为 MongoDB 添加了哪些基本功能?我想明确知道他们的功能。
【问题讨论】:
标签: javascript database mongodb mongoose
Mongoose 为 MongoDB 添加了哪些基本功能?我想明确知道他们的功能。
【问题讨论】:
标签: javascript database mongodb mongoose
MongoDB 是一个开源的 NoSQL 数据库管理系统,包含
列表项
多个服务器、数据聚合、服务器端 Javascript 执行和 Capped 集合。
MongoDB 是一个基于文档的数据库管理系统,它利用称为二进制 JSON 或 BSON 的 JSON 样式存储格式来实现高吞吐量。 JSON 使应用程序可以轻松地提取和操作数据,并允许对属性进行有效的索引、映射和嵌套,以支持复杂的查询操作和表达式。
MongooseJS 是一个对象文档映射器 (ODM),它通过将 MongoDB 数据库中的文档转换为程序中的对象来更轻松地使用 MongoDB。除了 MongooseJS,还有其他几个为 MongoDB 开发的 ODM,包括
相对于原生 MongoDB,使用 Mongoose 有一些优势,例如:
MongooseJS provides an abstraction layer on top of MongoDB that eliminates the need to use named collections。
Models in Mongoose perform the bulk of the work of establishing up default values for document properties and validating data。
Functions may be attached to Models in MongooseJS. This allows for seamless incorporation of new functionality。
Queries use function chaining rather than embedded mnemonics which result in code that is more flexible and readable, therefore more maintainable as well.
Mongoose 不仅有优点,但与原生 MongoDB 相比,还有一些缺点,比如抽象,以牺牲性能为代价。
但 Mongoose 的最终结果是简化了应用程序的数据库访问。
【讨论】: