How the drivers work
All MongoDB drivers perform three major functions.
First, they generateMongoDB object IDs. These are the default values stored in the _id field of all docu-
ments.
Next, the drivers convert any language-specific representation of documents to and from BSON, the binary data format used by MongoDB. In the foregoing examples, the driver serializes all the Ruby hashes into BSON and then deserializes the BSON that’s returned from the database back to Ruby hashes.
Final,the drivers is to communicate with the database over a TCP socket using the MongoDB wire protocol.
Object ID generation
Every MongoDB document requires a primary key. That key, which must be unique for all documents in each collection, is referenced by a document’s _id field. Developers are free to use their own custom values as the _id, but when not provided, a MongoDB object ID will be used. Before sending a document to the server, the driver checks whether the _id field is present. If the field is missing, an object ID proper will be generated and stored as _id.
BSON
BSON is the binary format used to represent documents in MongoDB. BSON acts as both a storage and command format: all documents are stored on disk as BSON, and all queries and commands are specified using BSON documents. Consequently, all MongoDB drivers must be able to translate between some language-specific document representation and BSON.
相关推荐
What’s inside: The book will cover the process of understanding about Big Data, NoSQL and MongoDB in the following few steps: 1: Introduction to Big Data and NoSQL 2: Introduction to MongoDB 3: ...
2. **高性能**:通过内存映射技术,MongoDB能够快速地读写数据,提供了极高的性能。 3. **高可用性**:MongoDB提供了复制集功能,确保数据的冗余和故障切换。 4. **灵活的数据模型**:支持动态模式,无需预定义架构...
在学习MongoDB时,你可以通过《MongoDB Introduction》这份PPT深入了解其基本概念、安装与配置、数据模型、CRUD操作(创建、读取、更新、删除)、索引创建、复制集和分片等核心内容。此外,通过阅读博客文章(如链接...
Practical Guide to MongoDB: Architecting, Developing, and Administering MongoDB begins with a short introduction to the basics of NoSQL databases and then introduces readers to MongoDB—the leading ...
With this authoritative introduction, you'll learn the many advantages of using document-oriented databases, and discover why MongoDB is a reliable, high-performance system that allows for almost ...
Need a quick and easy to understand introduction to MongoDB and NoSQL databases? MongoDB Basics, from The Definitive ... 2: Installing MongoDB Ch. 3: The Data Model Ch. 4: Working with Data Ch. 5: GridFS
2. 自动分片(Sharding):MongoDB提供了自动分片功能,可以将大型数据集分散到多个机器上,实现数据的自动负载均衡。 3. 高可用性:MongoDB通过复制集提供高可用性,复制集中的多个副本可以在主节点故障时接管服务...
MongoDB is a document-oriented database management system designed ...If you’d like to learn how to use MongoDB with your programming language of choice, see the introduction to the drivers (page 393).
2: Getting Started with Node.js 3: Building an Express Web Application 4: Introduction to MongoDB 5: Introduction to Mongoose 6: Managing User Authentication Using Passport 7: Introduction to ...
Chapter2: Data Modeling 2.1 Referencing or Embedding Data 2.2When to use Referencing 2.3 Reference Relationship Patterns 2.4AHybrid Approach 2.5 Differentiating Document Types 2.6Running Out of Space ...
- MongoDB Shell入门(Introduction to the MongoDB Shell):介绍如何使用MongoDB的交互式命令行界面来执行各种操作。 - MongoDB客户端(MongoDB Client):指导如何连接到MongoDB实例,使用各种工具和程序语言的...
- **第一章:Introduction(介绍)** - **知识点**: - **ARichDataModel(丰富的数据模型)**: MongoDB采用了面向文档的数据模型,支持嵌套结构,可以存储复杂的数据类型,如数组和对象。 - **EasyScaling...
- **Introduction**:MongoDB 简介。 - **Quickstart**:快速入门指南,包括不同操作系统的安装步骤。 - **Downloads**:下载页面,列出不同版本的发布说明。 - **Drivers**:支持的各种语言驱动程序介绍。 - *...