MongoDB\Driver下各大类简单介绍

来源:互联网 发布:linux拷贝文件命令失败 编辑:程序博客网 时间:2024/06/14 17:16

原本的mongo扩展没有这么麻烦,但是奈何我Ubuntu的操作系统,装不了mongo的扩展,只能装mongodb,所以,加油吧。

Manager

我的上一篇文章

入口文件

Command

The MongoDB\Driver\Command class is a value object that represents a database command.

To provide “Command Helpers” the MongoDB\Driver\Command object should be composed.

MongoDB\Driver\Command类的有效对象主要用于执行命令。

该类是最终类(final),俗称黑寡妇。

Query

The MongoDB\Driver\Query class is a value object that represents a database query.

MongoDB\Driver\Query类的有效对象主要用于查询。

BulkWrite

The MongoDB\Driver\BulkWrite collects one or more write operations that should be sent to the server. After adding any number of insert, update, and delete operations, the collection may be executed via MongoDB\Driver\Manager::executeBulkWrite().

Write operations may either be ordered (default) or unordered. Ordered write operations are sent to the server, in the order provided, for serial execution. If a write fails, any remaining operations will be aborted. Unordered operations are sent to the server in an arbitrary order where they may be executed in parallel. Any errors that occur are reported after all operations have been attempted.

当执行一次或者多次MongoDB\Driver\BulkWrite的insert、update、delete操作后,只会在执行MongoDB\Driver\Manager::executeBulkWrite()方法的时候,将数据发送给服务器。

写操作要么是有序的(默认设置),要么是无序的。当有多条记录需要执行时,有序的写操作根据添加顺序依次发送给服务器。中间发生错误时,还未发送的数据则消失。无序的操作会把记录无序的发送给服务器,即使这些记录是需要并行发送的。任何错误都会在所有记录都被尝试发送完后报告。

WriteConcern

MongoDB\Driver\WriteConcern describes the level of acknowledgement requested from MongoDB for write operations to a standalone mongod or to replica sets or to sharded clusters. In sharded clusters, mongos instances will pass the write concern on to the shards.

MongoDB\Driver\WriteConcern描述在向单独的mongod服务器、集群或者分片请求写数据库时的确认程度。在分片中,mongos实例会把write concern传递给分片。

ReadPreference

ReadConcern

MongoDB\Driver\ReadConcern controls the level of isolation for read operations for replica sets and replica set shards. This option requires the WiredTiger storage engine and MongoDB 3.2 or later.

Cursor

The MongoDB\Driver\Cursor class encapsulates the results of a MongoDB command or query and may be returned by MongoDB\Driver\Manager::executeCommand() or MongoDB\Driver\Manager::executeQuery(), respectively.

MongoDB\Driver\Cursor类分别封装了MongoDB\Driver\Manager::executeCommand(),MongoDB\Driver\Manager::executeQuery()的返回结果。

CursorId

Server

WriteConcernError

WriteError

WriteResult

原创粉丝点击