PHP MongoDB context options

王林
Release: 2023-09-16 08:18:01
forward
1373 people have browsed it

PHP MongoDB 上下文选项

Introduction

PHPYou can interact with the MongoDB database through database extensions. For older versions of PHP, the mongo driver can be installed from PECL. Now superseded by the mongodb driver. Both drivers can be installed using precompiled binaries for Linux/Windows/MacOS operating systems. Alternatively, you can install manually from the source tarball available on github. In either case, the mongo or mongodb extension should be enabled in the php.ini settings.

The PHP MongoDB extension provides streaming context support using the mongodb context. The relevant context options are as follows

Options

log_cmd_insert ( array $server , array $document , array $writeOptions , array $protocolOptions )

This is a Callable function, used by log_cmd_insert context options when inserting a document

log_cmd_delete ( array $server , array $writeOptions , array $deleteOptions , array $protocolOptions )

This is a callback function used by the log_cmd_delete context options when a document is deleted

log_cmd_update ( array $server , array $writeOptions , array $updateOptions , array $protocolOptions )

This function is used by the log_cmd_update context options when updating a document

log_write_batch ( array $server , array $writeOptions , array $ batch , array $protocolOptions )

This function consists of log_write_batch context options when performing batch operations.

log_reply ( array $server , array $messageHeaders , array $operationHeaders )

This callback function is used when reading MongoDB replies

log_getmore (array $server, array $info)

When performing a GET_MORE operation, this callable function is controlled by log_getmore Context options

log_killcursor (array $server, array $info)

Callback when executing KILLCURSOR operation

$server The array contains basic information of the following parameters

hash− Server hash, for example: localhost:27017;-;X;56052

type - Node type (primary/secondary/mongos/arbiter) - 2

max_bson_size - Maximum BSON size for lines accepted by this node - 16777216

max_message_size - Lines accepted by this node Maximum message size on - 48000000

request_id − Request identifier for this message − 42

The above is the detailed content of PHP MongoDB context options. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!