MongoClient

A Vert.x service used to interact with MongoDB server instances.

Some of the operations might change _id field of passed document.

package

Default

Methods

__construct

__construct() 

Run aggregate MongoDB command with default @see \io\vertx\jphp\ext\mongo\AggregateOptions.

aggregate( $arg0,  $arg1) : \io\vertx\jphp\ext\mongo\ReadStream<JsonObject>

Arguments

$arg0

string

$arg1

array

Response

\io\vertx\jphp\ext\mongo\ReadStream

Run aggregate MongoDB command.

aggregateWithOptions( $arg0,  $arg1,  $arg2) : \io\vertx\jphp\ext\mongo\ReadStream<JsonObject>

Arguments

$arg0

string

$arg1

array

$arg2

AggregateOptions | array

Response

\io\vertx\jphp\ext\mongo\ReadStream

Execute a bulk operation. Can insert, update, replace, and/or delete multiple documents with one request.

bulkWrite( $arg0,  $arg1,  $arg2) : $this

Arguments

$arg0

string

$arg1

array

$arg2

callable

Response

$this

Execute a bulk operation with the specified write options. Can insert, update, replace, and/or delete multiple documents with one request.

bulkWriteWithOptions( $arg0,  $arg1,  $arg2,  $arg3) : $this

Arguments

$arg0

string

$arg1

array

$arg2

BulkWriteOptions | array

$arg3

callable

Response

$this

Close the client and release its resources

close() : void

Count matching documents in a collection.

count( $arg0,  $arg1,  $arg2) : $this

Arguments

$arg0

string

$arg1

array

$arg2

callable

Response

$this

Create a new collection

createCollection( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

callable

Response

$this

Creates an index.

createIndex( $arg0,  $arg1,  $arg2) : $this

Arguments

$arg0

string

$arg1

array

$arg2

callable

Response

$this

Creates an index.

createIndexWithOptions( $arg0,  $arg1,  $arg2,  $arg3) : $this

Arguments

$arg0

string

$arg1

array

$arg2

IndexOptions | array

$arg3

callable

Response

$this

Create a Mongo client which maintains its own data source.

createNonShared( $arg0,  $arg1) : \io\vertx\jphp\ext\mongo\MongoClient
static

Arguments

$arg0

Vertx

$arg1

array

Response

\io\vertx\jphp\ext\mongo\MongoClient

the client

Like @see \io\vertx\jphp\ext\mongo\MongoClient::createShared but with the default data source name

createShared( $arg0,  $arg1,  $arg2 = null) : \io\vertx\jphp\ext\mongo\MongoClient
static

param $vertx [Vertx] the Vert.x instance param $config [array] the configuration createShared($vertx, $config)

Create a Mongo client which shares its data source with any other Mongo clients created with the same data source name

param $vertx [Vertx] the Vert.x instance param $config [array] the configuration param $dataSourceName [string] the data source name createShared($vertx, $config, $dataSourceName)

Arguments

$arg0

Vertx

$arg1

array

$arg2

string

Response

\io\vertx\jphp\ext\mongo\MongoClient

the client

Gets the distinct values of the specified field name.

distinct( $arg0,  $arg1,  $arg2,  $arg3) : $this

Return a JsonArray containing distinct values (eg: [ 1 , 89 ])

Arguments

$arg0

string

$arg1

string

$arg2

string

$arg3

callable

Response

$this

Gets the distinct values of the specified field name.

distinctBatch( $arg0,  $arg1,  $arg2) : \io\vertx\jphp\ext\mongo\ReadStream<JsonObject>

This method use batchCursor for returning each found value. Each value is a json fragment with fieldName key (eg: {"num": 1}).

Arguments

$arg0

string

$arg1

string

$arg2

string

Response

\io\vertx\jphp\ext\mongo\ReadStream

a {@link ReadStream} emitting json fragments

Gets the distinct values of the specified field name filtered by specified query.

distinctBatchWithQuery( $arg0,  $arg1,  $arg2,  $arg3,  $arg4 = null) : \io\vertx\jphp\ext\mongo\ReadStream<JsonObject>

This method use batchCursor for returning each found value. Each value is a json fragment with fieldName key (eg: {"num": 1}).

param $collection [string] the collection param $fieldName [string] the field name param $resultClassname [string] param $query [array] the query distinctBatchWithQuery($collection, $fieldName, $resultClassname, $query)

Gets the distinct values of the specified field name filtered by specified query. This method use batchCursor for returning each found value. Each value is a json fragment with fieldName key (eg: {"num": 1}).

param $collection [string] the collection param $fieldName [string] the field name param $resultClassname [string] param $query [array] the query param $batchSize [integer] the number of documents to load in a batch distinctBatchWithQuery($collection, $fieldName, $resultClassname, $query, $batchSize)

Arguments

$arg0

string

$arg1

string

$arg2

string

$arg3

array

$arg4

integer

Response

\io\vertx\jphp\ext\mongo\ReadStream

a {@link ReadStream} emitting json fragments

Gets the distinct values of the specified field name filtered by specified query.

distinctWithQuery( $arg0,  $arg1,  $arg2,  $arg3,  $arg4) : $this

Return a JsonArray containing distinct values (eg: [ 1 , 89 ])

Arguments

$arg0

string

$arg1

string

$arg2

string

$arg3

array

$arg4

callable

Response

$this

Drop a collection

dropCollection( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

callable

Response

$this

Drops the index given its name.

dropIndex( $arg0,  $arg1,  $arg2) : $this

Arguments

$arg0

string

$arg1

string

$arg2

callable

Response

$this

Find matching documents in the specified collection

find( $arg0,  $arg1,  $arg2) : $this

Arguments

$arg0

string

$arg1

array

$arg2

callable

Response

$this

Find matching documents in the specified collection.

findBatch( $arg0,  $arg1) : \io\vertx\jphp\ext\mongo\ReadStream<JsonObject>

This method use batchCursor for returning each found document.

Arguments

$arg0

string

$arg1

array

Response

\io\vertx\jphp\ext\mongo\ReadStream

a {@link ReadStream} emitting found documents

Find matching documents in the specified collection, specifying options.

findBatchWithOptions( $arg0,  $arg1,  $arg2) : \io\vertx\jphp\ext\mongo\ReadStream<JsonObject>

This method use batchCursor for returning each found document.

Arguments

$arg0

string

$arg1

array

$arg2

FindOptions | array

Response

\io\vertx\jphp\ext\mongo\ReadStream

a {@link ReadStream} emitting found documents

Find a single matching document in the specified collection <p> This operation might change <i>_id</i> field of <i>query</i> parameter

findOne( $arg0,  $arg1,  $arg2,  $arg3) : $this

Arguments

$arg0

string

$arg1

array

$arg2

array

$arg3

callable

Response

$this

Find a single matching document in the specified collection and delete it.

findOneAndDelete( $arg0,  $arg1,  $arg2) : $this

This operation might change _id field of query parameter

Arguments

$arg0

string

$arg1

array

$arg2

callable

Response

$this

Find a single matching document in the specified collection and delete it.

findOneAndDeleteWithOptions( $arg0,  $arg1,  $arg2,  $arg3) : $this

This operation might change _id field of query parameter

Arguments

$arg0

string

$arg1

array

$arg2

FindOptions | array

$arg3

callable

Response

$this

Find a single matching document in the specified collection and replace it.

findOneAndReplace( $arg0,  $arg1,  $arg2,  $arg3) : $this

This operation might change _id field of query parameter

Arguments

$arg0

string

$arg1

array

$arg2

array

$arg3

callable

Response

$this

Find a single matching document in the specified collection and replace it.

findOneAndReplaceWithOptions( $arg0,  $arg1,  $arg2,  $arg3,  $arg4,  $arg5) : $this

This operation might change _id field of query parameter

Arguments

$arg0

string

$arg1

array

$arg2

array

$arg3

FindOptions | array

$arg4

array | UpdateOptions

$arg5

callable

Response

$this

Find a single matching document in the specified collection and update it.

findOneAndUpdate( $arg0,  $arg1,  $arg2,  $arg3) : $this

This operation might change _id field of query parameter

Arguments

$arg0

string

$arg1

array

$arg2

array

$arg3

callable

Response

$this

Find a single matching document in the specified collection and update it.

findOneAndUpdateWithOptions( $arg0,  $arg1,  $arg2,  $arg3,  $arg4,  $arg5) : $this

This operation might change _id field of query parameter

Arguments

$arg0

string

$arg1

array

$arg2

array

$arg3

FindOptions | array

$arg4

array | UpdateOptions

$arg5

callable

Response

$this

Find matching documents in the specified collection, specifying options

findWithOptions( $arg0,  $arg1,  $arg2,  $arg3) : $this

Arguments

$arg0

string

$arg1

array

$arg2

FindOptions | array

$arg3

callable

Response

$this

Get a list of all collections in the database.

getCollections( $arg0) : $this

Arguments

$arg0

callable

Response

$this

Insert a document in the specified collection <p> This operation might change <i>_id</i> field of <i>document</i> parameter

insert( $arg0,  $arg1,  $arg2) : $this

Arguments

$arg0

string

$arg1

array

$arg2

callable

Response

$this

Insert a document in the specified collection with the specified write option <p> This operation might change <i>_id</i> field of <i>document</i> parameter

insertWithOptions( $arg0,  $arg1,  $arg2,  $arg3) : $this

Arguments

$arg0

string

$arg1

array

$arg2

string

$arg3

callable

Response

$this

Get all the indexes in this collection.

listIndexes( $arg0,  $arg1) : $this

Arguments

$arg0

string

$arg1

callable

Response

$this

Remove matching documents from a collection

remove( $arg0,  $arg1,  $arg2) : $this
deprecated

Arguments

$arg0

string

$arg1

array

$arg2

callable

Response

$this

Remove a single matching document from a collection and return the handler with MongoClientDeleteResult result

removeDocument( $arg0,  $arg1,  $arg2) : $this

Arguments

$arg0

string

$arg1

array

$arg2

callable

Response

$this

Remove matching documents from a collection and return the handler with MongoClientDeleteResult result

removeDocuments( $arg0,  $arg1,  $arg2) : $this

Arguments

$arg0

string

$arg1

array

$arg2

callable

Response

$this

Remove matching documents from a collection with the specified write option and return the handler with MongoClientDeleteResult result

removeDocumentsWithOptions( $arg0,  $arg1,  $arg2,  $arg3) : $this

Arguments

$arg0

string

$arg1

array

$arg2

string

$arg3

callable

Response

$this

Remove a single matching document from a collection with the specified write option and return the handler with MongoClientDeleteResult result

removeDocumentWithOptions( $arg0,  $arg1,  $arg2,  $arg3) : $this

Arguments

$arg0

string

$arg1

array

$arg2

string

$arg3

callable

Response

$this

Remove a single matching document from a collection

removeOne( $arg0,  $arg1,  $arg2) : $this
deprecated

Arguments

$arg0

string

$arg1

array

$arg2

callable

Response

$this

Remove a single matching document from a collection with the specified write option

removeOneWithOptions( $arg0,  $arg1,  $arg2,  $arg3) : $this
deprecated

Arguments

$arg0

string

$arg1

array

$arg2

string

$arg3

callable

Response

$this

Remove matching documents from a collection with the specified write option

removeWithOptions( $arg0,  $arg1,  $arg2,  $arg3) : $this
deprecated

Arguments

$arg0

string

$arg1

array

$arg2

string

$arg3

callable

Response

$this

Replace matching documents in the specified collection <p> This operation might change <i>_id</i> field of <i>replace</i> parameter

replace( $arg0,  $arg1,  $arg2,  $arg3) : $this
deprecated

Arguments

$arg0

string

$arg1

array

$arg2

array

$arg3

callable

Response

$this

Replace matching documents in the specified collection and return the handler with MongoClientUpdateResult result

replaceDocuments( $arg0,  $arg1,  $arg2,  $arg3) : $this

Arguments

$arg0

string

$arg1

array

$arg2

array

$arg3

callable

Response

$this

Replace matching documents in the specified collection, specifying options and return the handler with MongoClientUpdateResult result

replaceDocumentsWithOptions( $arg0,  $arg1,  $arg2,  $arg3,  $arg4) : $this

Arguments

$arg0

string

$arg1

array

$arg2

array

$arg3

array | UpdateOptions

$arg4

callable

Response

$this

Replace matching documents in the specified collection, specifying options <p> This operation might change <i>_id</i> field of <i>replace</i> parameter

replaceWithOptions( $arg0,  $arg1,  $arg2,  $arg3,  $arg4) : $this
deprecated

Arguments

$arg0

string

$arg1

array

$arg2

array

$arg3

array | UpdateOptions

$arg4

callable

Response

$this

Run an arbitrary MongoDB command.

runCommand( $arg0,  $arg1,  $arg2) : $this

Arguments

$arg0

string

$arg1

array

$arg2

callable

Response

$this

Save a document in the specified collection <p> This operation might change <i>_id</i> field of <i>document</i> parameter

save( $arg0,  $arg1,  $arg2) : $this

Arguments

$arg0

string

$arg1

array

$arg2

callable

Response

$this

Save a document in the specified collection with the specified write option <p> This operation might change <i>_id</i> field of <i>document</i> parameter

saveWithOptions( $arg0,  $arg1,  $arg2,  $arg3) : $this

Arguments

$arg0

string

$arg1

array

$arg2

string

$arg3

callable

Response

$this

Update matching documents in the specified collection

update( $arg0,  $arg1,  $arg2,  $arg3) : $this
deprecated

Arguments

$arg0

string

$arg1

array

$arg2

array

$arg3

callable

Response

$this

Update matching documents in the specified collection and return the handler with MongoClientUpdateResult result

updateCollection( $arg0,  $arg1,  $arg2,  $arg3) : $this

Arguments

$arg0

string

$arg1

array

$arg2

array

$arg3

callable

Response

$this

Update matching documents in the specified collection, specifying options and return the handler with MongoClientUpdateResult result

updateCollectionWithOptions( $arg0,  $arg1,  $arg2,  $arg3,  $arg4) : $this

Arguments

$arg0

string

$arg1

array

$arg2

array

$arg3

array | UpdateOptions

$arg4

callable

Response

$this

Update matching documents in the specified collection, specifying options

updateWithOptions( $arg0,  $arg1,  $arg2,  $arg3,  $arg4) : $this
deprecated

Arguments

$arg0

string

$arg1

array

$arg2

array

$arg3

array | UpdateOptions

$arg4

callable

Response

$this

Constants

The name of the default pool

DEFAULT_POOL_NAME
var

php文件只是为了写代码方便,常量的实际值请参考原java文件

The name of the default database

DEFAULT_DB_NAME
var

php文件只是为了写代码方便,常量的实际值请参考原java文件