· 7 years ago · Feb 25, 2019, 11:10 AM
1<?php
2/*
3 * Mongo extension stubs
4 * Gathered from http://www.php.net/manual/en/book.mongo.php
5 * Maintainer: Alexander Makarov, sam@rmcreative.ru, max@upgradeyour.com
6 *
7 * MongoClient: https://github.com/djsipe/PHP-Stubs
8 */
9
10/**
11 * A connection between PHP and MongoDB. This class is used to create and manage connections
12 * See MongoClient::__construct() and the section on connecting for more information about creating connections.
13 * @link http://www.php.net/manual/en/class.mongoclient.php
14 */
15class MongoClient
16{
17 const VERSION = '3.x';
18 const DEFAULT_HOST = "localhost" ;
19 const DEFAULT_PORT = 27017 ;
20 const RP_PRIMARY = "primary" ;
21 const RP_PRIMARY_PREFERRED = "primaryPreferred" ;
22 const RP_SECONDARY = "secondary" ;
23 const RP_SECONDARY_PREFERRED = "secondaryPreferred" ;
24 const RP_NEAREST = "nearest" ;
25
26 /* Properties */
27 public $connected = FALSE ;
28 public $status = NULL ;
29 protected $server = NULL ;
30 protected $persistent = NULL ;
31
32 /* Methods */
33 /**
34 * Creates a new database connection object
35 * @link https://php.net/manual/en/mongo.construct.php
36 * @param string $server [optional] The server name.
37 * @param array $options [optional] An array of options for the connection. Currently
38 * available options include: "connect" If the constructor should connect before
39 * returning. Default is true. "timeout" For how long the driver should try to
40 * connect to the database (in milliseconds). "replicaSet" The name of the replica
41 * set to connect to. If this is given, the master will be determined by using the
42 * ismaster database command on the seeds, so the driver may end up connecting to a
43 * server that was not even listed. See the replica set example below for details.
44 * "username" The username can be specified here, instead of including it in the
45 * host list. This is especially useful if a username has a ":" in it. This
46 * overrides a username set in the host list. "password" The password can be
47 * specified here, instead of including it in the host list. This is especially
48 * useful if a password has a "@" in it. This overrides a password set in the host
49 * list. "db" The database to authenticate against can be specified here, instead
50 * of including it in the host list. This overrides a database given in the host
51 * list "fsync" When "fsync" is set, all write operations will block until the database has flushed the changes to disk. This makes the write operations slower, but it guarantees that writes have succeeded and that the operations can be recovered in case of total system failure.
52 * If the MongoDB server has journaling enabled, this option is identical to "journal". If journaling is not enabled, this option ensures that write operations will be synced to database files on disk.
53 * "journal"
54 * When "journal" is set, all write operations will block until the database has flushed the changes to the journal on disk. This makes the write operations slower, but it guarantees that writes have succeeded and that the operations can be recovered in case of total system failure.
55 * Note: If this option is used and journaling is disabled, MongoDB 2.6+ will raise an error and the write will fail; older server versions will simply ignore the option.
56 * "gssapiServiceName"
57 * Sets the » Kerberos service principal. Only applicable when authMechanism=GSSAPI. Defaults to "mongodb".
58 * "password"
59 * The password can be specified here, instead of including it in the host list. This is especially useful if a password has a "@" in it. This overrides a password set in the host list.
60 * "readPreference"
61 * Specifies the read preference type. Read preferences provide you with control from which secondaries data can be read from.
62 * Allowed values are: MongoClient::RP_PRIMARY, MongoClient::RP_PRIMARY_PREFERRED, MongoClient::RP_SECONDARY, MongoClient::RP_SECONDARY_PREFERRED and MongoClient::RP_NEAREST.
63 * See the documentation on read preferences for more information.
64 * "readPreferenceTags"
65 * Specifies the read preference tags as an array of strings. Tags can be used in combination with the readPreference option to further control which secondaries data might be read from.
66 * See the documentation on read preferences for more information.
67 * "replicaSet"
68 * The name of the replica set to connect to. If this is given, the primary will be automatically be determined. This means that the driver may end up connecting to a server that was not even listed. See the replica set example below for details.
69 * "secondaryAcceptableLatencyMS"
70 * When reading from a secondary (using ReadPreferences), do not read from secondaries known to be more then secondaryAcceptableLatencyMS away from us. Defaults to 15
71 * "socketTimeoutMS"
72 * How long a socket operation (read or write) can take before timing out in milliseconds. Defaults to 30000 (30 seconds).
73 * If -1 is specified, socket operations may block indefinitely. This option may also be set on a per-operation basis using MongoCursor::timeout() for queries or the "socketTimeoutMS" option for write methods.
74 * Note: This is a client-side timeout. If a write operation times out, there is no way to know if the server actually handled the write or not, as a MongoCursorTimeoutException will be thrown in lieu of returning a write result.
75 * "ssl"
76 * A boolean to specify whether you want to enable SSL for the connections to MongoDB. Extra options such as certificates can be set with SSL context options.
77 * "username"
78 * The username can be specified here, instead of including it in the host list. This is especially useful if a username has a ":" in it. This overrides a username set in the host list.
79 * "w"
80 * The w option specifies the Write Concern for the driver, which determines how long the driver blocks when writing. The default value is 1.
81 * This option is applicable when connecting to both single servers and replica sets. A positive value controls how many nodes must acknowledge the write instruction before the driver continues. A value of 1 would require the single server or primary (in a replica set) to acknowledge the write operation. A value of 3 would cause the driver to block until the write has been applied to the primary as well as two secondary servers (in a replica set).
82 * A string value is used to control which tag sets are taken into account for write concerns. "majority" is special and ensures that the write operation has been applied to the majority (more than 50%) of the participating nodes.
83 * "wTimeoutMS" This option specifies the time limit, in milliseconds, for write concern acknowledgement. It is only applicable for write operations where "w" is greater than 1, as the timeout pertains to replication. If the write concern is not satisfied within the time limit, a MongoCursorException will be thrown. A value of 0 may be specified to block indefinitely. The default value is 10000 (ten seconds).
84 * @param array $driver_options [optional] <p>
85 * An array of options for the MongoDB driver. Options include setting
86 * connection {@link https://php.net/manual/en/mongo.connecting.ssl.php#mongo.connecting.context.ssl context options for SSL}
87 * or {@link https://php.net/manual/en/context.mongodb.php logging callbacks}.
88 * </p><ul>
89 * <li>
90 * <p>
91 * <em>"context"</em>
92 * </p>
93 * <p>
94 * The Stream Context to attach to all new connections. This allows you
95 * for example to configure SSL certificates and are described at
96 * {@link https://php.net/manual/en/context.ssl.php SSL context options}. See the
97 * {@link https://php.net/manual/en/mongo.connecting.ssl.php#mongo.connecting.context.ssl Connecting over SSL} tutorial.
98 * </p>
99 * </li>
100 * </ul>
101 * @throws MongoConnectionException
102 */
103 public function __construct($server = "mongodb://localhost:27017", array $options = array("connect" => TRUE), $driver_options) {}
104
105 /**
106 * (PECL mongo >= 1.3.0)<br/>
107 * Closes this database connection
108 * This method does not need to be called, except in unusual circumstances.
109 * The driver will cleanly close the database connection when the Mongo object goes out of scope.
110 * @link http://www.php.net/manual/en/mongoclient.close.php
111 * @param boolean|string $connection [optional] <p>
112 * If connection is not given, or <b>FALSE</b> then connection that would be selected for writes would be closed. In a single-node configuration, that is then the whole connection, but if you are connected to a replica set, close() will only close the connection to the primary server.
113 * If connection is <b>TRUE</b> then all connections as known by the connection manager will be closed. This can include connections that are not referenced in the connection string used to create the object that you are calling close on.
114 * If connection is a string argument, then it will only close the connection identified by this hash. Hashes are identifiers for a connection and can be obtained by calling {@see MongoClient::getConnections()}.
115 * </p>
116 * @return boolean If the connection was successfully closed.
117 */
118 public function close($connection) {}
119 /**
120 * Connects to a database server
121 *
122 * @link http://www.php.net/manual/en/mongoclient.connect.php
123 *
124 * @throws MongoConnectionException
125 * @return boolean If the connection was successful.
126 */
127 public function connect() {}
128
129 /**
130 * @deprecated Use MongoDB::drop() instead.
131 * Drops a database
132 *
133 * @link http://www.php.net/manual/en/mongoclient.dropdb.php
134 * @param mixed $db The database to drop. Can be a MongoDB object or the name of the database.
135 * @return array The database response.
136 */
137 public function dropDB($db) {}
138
139 /**
140 * (PECL mongo >= 1.3.0)<br/>
141 * Gets a database
142 * @link https://php.net/manual/en/mongoclient.get.php
143 * @param string $dbname The database name.
144 * @return MongoDB The database name.
145 */
146 public function __get ($dbname)
147 {}
148
149 /**
150 * Get connections
151 * Returns an array of all open connections, and information about each of the servers
152 * @static
153 * @return array
154 */
155 static public function getConnections ()
156 {}
157
158 /**
159 * Get hosts
160 * This method is only useful with a connection to a replica set. It returns the status of all of the hosts in the
161 * set. Without a replica set, it will just return an array with one element containing the host that you are
162 * connected to.
163 * @return array
164 */
165 public function getHosts ()
166 {}
167
168 /**
169 * Get read preference
170 * Get the read preference for this connection
171 * @return array
172 */
173 public function getReadPreference ()
174 {}
175
176 /**
177 * (PECL mongo >= 1.5.0)<br/>
178 * Get the write concern for this connection
179 * @return array <p>This function returns an array describing the write concern.
180 * The array contains the values w for an integer acknowledgement level or string mode,
181 * and wtimeout denoting the maximum number of milliseconds to wait for the server to satisfy the write concern.</p>
182 */
183 public function getWriteConcern () {}
184
185
186 /**
187 * Kills a specific cursor on the server
188 * @link http://www.php.net/manual/en/mongoclient.killcursor.php
189 * @param string $server_hash <p>
190 * The server hash that has the cursor. This can be obtained through
191 * {@link http://www.php.net/manual/en/mongocursor.info.php MongoCursor::info()}.
192 * </p>
193 * @param int|MongoInt64 $id
194 * <p>
195 * The ID of the cursor to kill. You can either supply an {@link http://www.php.net/manual/en/language.types.integer.php int}
196 * containing the 64 bit cursor ID, or an object of the
197 * {@link http://www.php.net/manual/en/class.mongoint64.php MongoInt64} class. The latter is necessary on 32
198 * bit platforms (and Windows).
199 * </p>
200 */
201 public function killCursor ( $server_hash , $id) {}
202
203 /**
204 * (PECL mongo >= 1.3.0)<br/>
205 * Lists all of the databases available
206 * @link https://php.net/manual/en/mongoclient.listdbs.php
207 * @return array Returns an associative array containing three fields. The first field is databases, which in turn contains an array. Each element of the array is an associative array corresponding to a database, giving the database's name, size, and if it's empty. The other two fields are totalSize (in bytes) and ok, which is 1 if this method ran successfully.
208 */
209 public function listDBs() {}
210
211
212 /**
213 * (PECL mongo >= 1.3.0)<br/>
214 * Gets a database collection
215 * @link http://www.php.net/manual/en/mongoclient.selectcollection.php
216 * @param string $db The database name.
217 * @param string $collection The collection name.
218 * @throws Exception Throws Exception if the database or collection name is invalid.
219 * @return MongoCollection Returns a new collection object.
220 */
221 public function selectCollection($db, $collection) {}
222
223 /**
224 * (PECL mongo >= 1.3.0)<br/>
225 * Gets a database
226 * @link http://www.php.net/manual/en/mongo.selectdb.php
227 * @param string $name The database name.
228 * @throws InvalidArgumentException
229 * @return MongoDB Returns a new db object.
230 */
231 public function selectDB($name) {}
232
233 /**
234 * (PECL mongo >= 1.3.0)<br/>
235 * Set read preference
236 * @param string $readPreference
237 * @param array $tags
238 * @return bool
239 */
240 public function setReadPreference ($readPreference, $tags=null)
241 {}
242
243 /**
244 * (PECL mongo >= 1.1.0)<br/>
245 * Choose a new secondary for slaveOkay reads
246 * @link www.php.net/manual/en/mongo.switchslave.php
247 * @return string The address of the secondary this connection is using for reads. This may be the same as the previous address as addresses are randomly chosen. It may return only one address if only one secondary (or only the primary) is available.
248 * For example, if we had a three member replica set with a primary, secondary, and arbiter this method would always return the address of the secondary. If the secondary became unavailable, this method would always return the address of the primary. If the primary also became unavailable, this method would throw an exception, as an arbiter cannot handle reads.
249 * @throws MongoException (error code 15) if it is called on a non-replica-set connection. It will also throw MongoExceptions if it cannot find anyone (primary or secondary) to read from (error code 16).
250 *
251 */
252 public function switchSlave() {}
253
254 /**
255 * String representation of this connection
256 * @link http://www.php.net/manual/en/mongoclient.tostring.php
257 * @return string Returns hostname and port for this connection.
258 */
259 public function __toString() {}
260}
261
262/**
263 * The connection point between MongoDB and PHP.
264 * This class is used to initiate a connection and for database server commands.
265 * @link http://www.php.net/manual/en/class.mongo.php
266 * @deprecated This class has been DEPRECATED as of version 1.3.0.
267 * Relying on this feature is highly discouraged. Please use MongoClient instead.
268 * @see MongoClient
269 */
270class Mongo extends MongoClient {
271 /**
272 * @deprecated This feature has been DEPRECATED as of version 1.2.3. Relying on this feature is highly discouraged. Please use MongoPool::getSize() instead.
273 * (PECL mongo >= 1.2.0)<br/>
274 * Get pool size for connection pools
275 * @link https://php.net/manual/en/mongo.getpoolsize.php
276 * @return int Returns the current pool size.
277 */
278 public function getPoolSize() {}
279 /**
280 * (PECL mongo >= 1.1.0)<br/>
281 * Returns the address being used by this for slaveOkay reads
282 * @link https://php.net/manual/en/mongo.getslave.php
283 * @return bool <p>The address of the secondary this connection is using for reads.
284 * </p>
285 * <p>
286 * This returns <b>NULL</b> if this is not connected to a replica set or not yet
287 * initialized.
288 * </p>
289 */
290 public function getSlave() {}
291 /**
292 * (PECL mongo >= 1.1.0)<br/>
293 * Get slaveOkay setting for this connection
294 * @link https://php.net/manual/en/mongo.getslaveokay.php
295 * @return bool Returns the value of slaveOkay for this instance.
296 */
297 public function getSlaveOkay() {}
298 /**
299 * Connects to paired database server
300 * @deprecated Pass a string of the form "mongodb://server1,server2" to the constructor instead of using this method.
301 * @link http://www.php.net/manual/en/mongo.pairconnect.php
302 * @throws MongoConnectionException
303 * @return boolean
304 */
305 public function pairConnect() {}
306
307 /**
308 * (PECL mongo >= 1.2.0)<br/>
309 * @deprecated This feature has been DEPRECATED as of version 1.2.3. Relying on this feature is highly discouraged. Please use MongoPool::info() instead.
310 * Returns information about all connection pools.
311 * @link https://php.net/manual/en/mongo.pooldebug.php
312 * @return array Each connection pool has an identifier, which starts with the host. For each pool, this function shows the following fields:
313 * <p><b>in use</b></p>
314 * <p>The number of connections currently being used by MongoClient instances.
315 * in pool
316 * The number of connections currently in the pool (not being used).</p>
317 * <p><b>remaining</b></p>
318 *
319 * <p>The number of connections that could be created by this pool. For example, suppose a pool had 5 connections remaining and 3 connections in the pool. We could create 8 new instances of MongoClient before we exhausted this pool (assuming no instances of MongoClient went out of scope, returning their connections to the pool).
320 *
321 * A negative number means that this pool will spawn unlimited connections.
322 *
323 * Before a pool is created, you can change the max number of connections by calling Mongo::setPoolSize(). Once a pool is showing up in the output of this function, its size cannot be changed.</p>
324 * <p><b>timeout</b></p>
325 *
326 * <p>The socket timeout for connections in this pool. This is how long connections in this pool will attempt to connect to a server before giving up.</p>
327 *
328 */
329 public function poolDebug() {}
330
331 /**
332 * (PECL mongo >= 1.1.0)<br/>
333 * Change slaveOkay setting for this connection
334 * @link https://php.net/manual/en/mongo.setslaveokay.php
335 * @param bool $ok [optional] <p class="para">
336 * If reads should be sent to secondary members of a replica set for all
337 * possible queries using this {@see MongoClient} instance.
338 * </p>
339 * @return bool returns the former value of slaveOkay for this instance.
340 */
341 public function setSlaveOkay ($ok) {}
342 /**
343 * @deprecated Relying on this feature is highly discouraged. Please use MongoPool::setSize() instead.
344 *(PECL mongo >= 1.2.0)<br/>
345 * Set the size for future connection pools.
346 * @link https://php.net/manual/en/mongo.setpoolsize.php
347 * @param $size <p>The max number of connections future pools will be able to create. Negative numbers mean that the pool will spawn an infinite number of connections.</p>
348 * @return bool Returns the former value of pool size.
349 */
350 public function setPoolSize($size) {}
351 /**
352 * Creates a persistent connection with a database server
353 * @link http://www.php.net/manual/en/mongo.persistconnect.php
354 * @deprecated Pass array("persist" => $id) to the constructor instead of using this method.
355 * @param string $username A username used to identify the connection.
356 * @param string $password A password used to identify the connection.
357 * @throws MongoConnectionException
358 * @return boolean If the connection was successful.
359 */
360 public function persistConnect($username = "", $password = "") {}
361
362 /**
363 * Creates a persistent connection with paired database servers
364 * @deprecated Pass "mongodb://server1,server2" and array("persist" => $id) to the constructor instead of using this method.
365 * @link http://www.php.net/manual/en/mongo.pairpersistconnect.php
366 * @param string $username A username used to identify the connection.
367 * @param string $password A password used to identify the connection.
368 * @throws MongoConnectionException
369 * @return boolean If the connection was successful.
370 */
371 public function pairPersistConnect($username = "", $password = "") {}
372
373 /**
374 * Connects with a database server
375 *
376 * @link http://www.php.net/manual/en/mongo.connectutil.php
377 * @throws MongoConnectionException
378 * @return boolean If the connection was successful.
379 */
380 protected function connectUtil() {}
381
382 /**
383 * Check if there was an error on the most recent db operation performed
384 * @deprecated Use MongoDB::lastError() instead.
385 * @link http://www.php.net/manual/en/mongo.lasterror.php
386 * @return array|null Returns the error, if there was one, or NULL.
387 */
388 public function lastError() {}
389
390 /**
391 * Checks for the last error thrown during a database operation
392 * @deprecated Use MongoDB::prevError() instead.
393 * @link http://www.php.net/manual/en/mongo.preverror.php
394 * @return array Returns the error and the number of operations ago it occurred.
395 */
396 public function prevError() {}
397
398 /**
399 * Clears any flagged errors on the connection
400 * @deprecated Use MongoDB::resetError() instead.
401 * @link http://www.php.net/manual/en/mongo.reseterror.php
402 * @return array Returns the database response.
403 */
404 public function resetError() {}
405
406 /**
407 * Creates a database error on the database.
408 * @deprecated Use MongoDB::forceError() instead.
409 * @link http://www.php.net/manual/en/mongo.forceerror.php
410 * @return boolean The database response.
411 */
412 public function forceError() {}
413}
414
415/**
416 * Instances of this class are used to interact with a database.
417 * @link http://www.php.net/manual/en/class.mongodb.php
418 */
419class MongoDB {
420 /**
421 * Profiling is off.
422 * @link https://php.net/manual/en/class.mongodb.php#mongodb.constants.profiling-off
423 */
424 const PROFILING_OFF = 0;
425
426 /**
427 * Profiling is on for slow operations (>100 ms).
428 * @link https://php.net/manual/en/class.mongodb.php#mongodb.constants.profiling-slow
429 */
430 const PROFILING_SLOW = 1;
431
432 /**
433 * Profiling is on for all operations.
434 * @link https://php.net/manual/en/class.mongodb.php#mongodb.constants.profiling-on
435 */
436 const PROFILING_ON = 2;
437
438 /**
439 * @var int
440 * <p>
441 * The number of servers to replicate a change to before returning success.
442 * Inherited by instances of {@link https://php.net/manual/en/class.mongocollection.php MongoCollection} derived
443 * from this. <em>w</em> functionality is only available in
444 * version 1.5.1+ of the MongoDB server and 1.0.8+ of the driver.
445 * </p>
446 * <p>
447 * <em>w</em> is used whenever you need to adjust the
448 * acknowledgement level
449 * ( {@link https://php.net/manual/en/mongocollection.insert.php MongoCollection::insert()},
450 * {@link https://php.net/manual/en/mongocollection.update.php MongoCollection::update()},
451 * {@link https://php.net/manual/en/mongocollection.remove.php MongoCollection::remove()},
452 * {@link https://php.net/manual/en/mongocollection.save.php MongoCollection::save()}, and
453 * {@link https://php.net/manual/en/mongocollection.ensureindex.php MongoCollection::ensureIndex()} all support this
454 * option). With the default value (1), an acknowledged operation will return once
455 * the database server has the operation. If the server goes down before
456 * the operation has been replicated to a secondary, it is possible to lose
457 * the operation forever. Thus, you can specify <em>w</em> to be
458 * higher than one and guarantee that at least one secondary has the
459 * operation before it is considered successful.
460 * </p>
461 * <p>
462 * For example, if <em>w</em> is 2, the primary and one secondary
463 * must have a record of the operation or the driver will throw a
464 * {@link https://php.net/manual/en/class.mongocursorexception.php MongoCursorException}. It is tempting to set
465 * <em>w</em> to the total number of secondaries + primary, but
466 * then if one secondary is down the operation will fail and an exception
467 * will be thrown, so usually <em>w=2</em> is safest (primary and
468 * one secondary).
469 * </p>
470 */
471 public $w = 1;
472
473 /**
474 * @var int <p>
475 * T he number of milliseconds to wait for <em>MongoDB::$w</em>
476 * replications to take place. Inherited by instances of
477 * {@link http://www.php.net/manual/en/class.mongocollection.php MongoCollection} derived from this.
478 * <em>w</em> functionality is only available in version 1.5.1+ of
479 * the MongoDB server and 1.0.8+ of the driver.
480 * </p>
481 * <p>
482 * Unless <em>wtimeout</em> is set, the server waits forever for
483 * replicating to <em>w</em> servers to finish. The driver
484 * defaults to waiting for 10 seconds, you can change this value to alter
485 * its behavior.
486 * </p>
487 */
488 public $wtimeout = 10000;
489
490 /**
491 * (PECL mongo >= 0.9.0)<br/>
492 * Creates a new database
493 * This method is not meant to be called directly. The preferred way to create an instance of MongoDB is through {@see Mongo::__get()} or {@see Mongo::selectDB()}.
494 * @link http://www.php.net/manual/en/mongodb.construct.php
495 * @param MongoClient $conn Database connection.
496 * @param string $name Database name.
497 * @throws Exception
498 */
499 public function __construct($conn, $name) {}
500
501 /**
502 * The name of this database
503 * @link http://www.php.net/manual/en/mongodb.--tostring.php
504 * @return string Returns this database's name.
505 */
506 public function __toString() {}
507
508 /**
509 * (PECL mongo >= 1.0.2)<br/>
510 * Gets a collection
511 * @link http://www.php.net/manual/en/mongodb.get.php
512 * @param string $name The name of the collection.
513 * @return MongoCollection
514 */
515 public function __get($name) {}
516
517 /**
518 * (PECL mongo >= 1.3.0)<br/>
519 * @link http://www.php.net/manual/en/mongodb.getcollectionnames.php
520 * Get all collections from this database
521 * @param bool $includeSystemCollections [optional] Include system collections.
522 * @return array Returns the names of the all the collections in the database as an
523 * {@link http://www.php.net/manual/en/language.types.array.php array}.
524 */
525 public function getCollectionNames($includeSystemCollections = false) {}
526
527 /**
528 * (PECL mongo >= 0.9.0)<br/>
529 * Fetches toolkit for dealing with files stored in this database
530 * @link http://www.php.net/manual/en/mongodb.getgridfs.php
531 * @param string $prefix [optional] The prefix for the files and chunks collections.
532 * @return MongoGridFS Returns a new gridfs object for this database.
533 */
534 public function getGridFS($prefix = "fs") {}
535
536 /**
537 * (PECL mongo >= 0.9.0)<br/>
538 * Gets this database's profiling level
539 * @link http://www.php.net/manual/en/mongodb.getprofilinglevel.php
540 * @return int Returns the profiling level.
541 */
542 public function getProfilingLevel() {}
543
544 /**
545 * (PECL mongo >= 1.1.0)<br/>
546 * Get slaveOkay setting for this database
547 * @link http://www.php.net/manual/en/mongodb.getslaveokay.php
548 * @return bool Returns the value of slaveOkay for this instance.
549 */
550 public function getSlaveOkay () {}
551 /**
552 * (PECL mongo >= 0.9.0)<br/>
553 * Sets this database's profiling level
554 * @link http://www.php.net/manual/en/mongodb.setprofilinglevel.php
555 * @param int $level Profiling level.
556 * @return int Returns the previous profiling level.
557 */
558 public function setProfilingLevel($level) {}
559
560 /**
561 * (PECL mongo >= 0.9.0)<br/>
562 * Drops this database
563 * @link http://www.php.net/manual/en/mongodb.drop.php
564 * @return array Returns the database response.
565 */
566 public function drop() {}
567
568 /**
569 * Repairs and compacts this database
570 * @link http://www.php.net/manual/en/mongodb.repair.php
571 * @param bool $preserve_cloned_files [optional] <p>If cloned files should be kept if the repair fails.</p>
572 * @param bool $backup_original_files [optional] <p>If original files should be backed up.</p>
573 * @return array <p>Returns db response.</p>
574 */
575 public function repair($preserve_cloned_files = FALSE, $backup_original_files = FALSE) {}
576
577 /**
578 * (PECL mongo >= 0.9.0)<br/>
579 * Gets a collection
580 * @link http://www.php.net/manual/en/mongodb.selectcollection.php
581 * @param string $name <b>The collection name.</b>
582 * @throws Exception if the collection name is invalid.
583 * @return MongoCollection <p>
584 * Returns a new collection object.
585 * </p>
586 */
587 public function selectCollection($name) {}
588
589 /**
590 * (PECL mongo >= 1.1.0)<br/>
591 * Change slaveOkay setting for this database
592 * @link https://php.net/manual/en/mongodb.setslaveokay.php
593 * @param bool $ok [optional] <p>
594 * If reads should be sent to secondary members of a replica set for all
595 * possible queries using this {@link http://www.php.net/manual/en/class.mongodb.php MongoDB} instance.
596 * </p>
597 * @return bool Returns the former value of slaveOkay for this instance.
598 */
599 public function setSlaveOkay ($ok = true) {}
600
601 /**
602 * Creates a collection
603 * @link http://www.php.net/manual/en/mongodb.createcollection.php
604 * @param string $name The name of the collection.
605 * @param array $options [optional] <p>
606 * <p>
607 * An array containing options for the collections. Each option is its own
608 * element in the options array, with the option name listed below being
609 * the key of the element. The supported options depend on the MongoDB
610 * server version. At the moment, the following options are supported:
611 * </p>
612 * <p>
613 * <b>capped</b>
614 * <p>
615 * If the collection should be a fixed size.
616 * </p>
617 * </p>
618 * <p>
619 * <b>size</b>
620 * <p>
621 * If the collection is fixed size, its size in bytes.</p></p>
622 * <p><b>max</b>
623 * <p>If the collection is fixed size, the maximum number of elements to store in the collection.</p></p>
624 * <i>autoIndexId</i>
625 *
626 * <p>
627 * If capped is <b>TRUE</b> you can specify <b>FALSE</b> to disable the
628 * automatic index created on the <em>_id</em> field.
629 * Before MongoDB 2.2, the default value for
630 * <em>autoIndexId</em> was <b>FALSE</b>.
631 * </p>
632 * </p>
633 * @return MongoCollection <p>Returns a collection object representing the new collection.</p>
634 */
635 public function createCollection($name, $options) {}
636
637 /**
638 * (PECL mongo >= 0.9.0)<br/>
639 * @deprecated Use MongoCollection::drop() instead.
640 * Drops a collection
641 * @link http://www.php.net/manual/en/mongodb.dropcollection.php
642 * @param MongoCollection|string $coll MongoCollection or name of collection to drop.
643 * @return array Returns the database response.
644 */
645 public function dropCollection($coll) {}
646
647 /**
648 * (PECL mongo >= 0.9.0)<br/>
649 * Get a list of collections in this database
650 * @link http://www.php.net/manual/en/mongodb.listcollections.php
651 * @param bool $includeSystemCollections [optional] <p>Include system collections.</p>
652 * @return array Returns a list of MongoCollections.
653 */
654 public function listCollections($includeSystemCollections = false) {}
655
656 /**
657 * (PECL mongo >= 0.9.0)<br/>
658 * Creates a database reference
659 * @link http://www.php.net/manual/en/mongodb.createdbref.php
660 * @param string $collection The collection to which the database reference will point.
661 * @param mixed $document_or_id <p>
662 * If an array or object is given, its <em>_id</em> field will be
663 * used as the reference ID. If a {@see MongoId} or scalar
664 * is given, it will be used as the reference ID.
665 * </p>
666 * @return array <p>Returns a database reference array.</p>
667 * <p>
668 * If an array without an <em>_id</em> field was provided as the
669 * <em>document_or_id</em> parameter, <b>NULL</b> will be returned.
670 * </p>
671 */
672 public function createDBRef($collection, $document_or_id) {}
673
674
675 /**
676 * (PECL mongo >= 0.9.0)<br/>
677 * Fetches the document pointed to by a database reference
678 * @link http://www.php.net/manual/en/mongodb.getdbref.php
679 * @param array $ref A database reference.
680 * @return array Returns the document pointed to by the reference.
681 */
682 public function getDBRef(array $ref) {}
683
684 /**
685 * (PECL mongo >= 1.5.0)<br/>
686 * Get the write concern for this database
687 * @link https://php.net/manual/en/mongodb.getwriteconcern.php
688 * @return array <p>This function returns an array describing the write concern.
689 * The array contains the values w for an integer acknowledgement level or string mode,
690 * and wtimeout denoting the maximum number of milliseconds to wait for the server to satisfy the write concern.</p>
691 */
692 public function getWriteConcern() {}
693 /**
694 * (PECL mongo >= 0.9.3)<br/>
695 * Runs JavaScript code on the database server.
696 * @link http://www.php.net/manual/en/mongodb.execute.php
697 * @param MongoCode|string $code Code to execute.
698 * @param array $args [optional] Arguments to be passed to code.
699 * @return array Returns the result of the evaluation.
700 */
701 public function execute($code, array $args = array()) {}
702
703 /**
704 * Execute a database command
705 * @link http://www.php.net/manual/en/mongodb.command.php
706 * @param array $data The query to send.
707 * @param array $options [optional] <p>
708 * This parameter is an associative array of the form
709 * <em>array("optionname" => <boolean>, ...)</em>. Currently
710 * supported options are:
711 * </p><ul>
712 * <li><p><em>"timeout"</em></p><p>Deprecated alias for <em>"socketTimeoutMS"</em>.</p></li>
713 * </ul>
714 * @return array Returns database response.
715 * Every database response is always maximum one document,
716 * which means that the result of a database command can never exceed 16MB.
717 * The resulting document's structure depends on the command,
718 * but most results will have the ok field to indicate success or failure and results containing an array of each of the resulting documents.
719 */
720 public function command(array $data, $options) {}
721
722 /**
723 * (PECL mongo >= 0.9.5)<br/>
724 * Check if there was an error on the most recent db operation performed
725 * @link http://www.php.net/manual/en/mongodb.lasterror.php
726 * @return array Returns the error, if there was one.
727 */
728 public function lastError() {}
729
730 /**
731 * (PECL mongo >= 0.9.5)<br/>
732 * Checks for the last error thrown during a database operation
733 * @link http://www.php.net/manual/en/mongodb.preverror.php
734 * @return array Returns the error and the number of operations ago it occurred.
735 */
736 public function prevError() {}
737
738 /**
739 * (PECL mongo >= 0.9.5)<br/>
740 * Clears any flagged errors on the database
741 * @link http://www.php.net/manual/en/mongodb.reseterror.php
742 * @return array Returns the database response.
743 */
744 public function resetError() {}
745
746 /**
747 * (PECL mongo >= 0.9.5)<br/>
748 * Creates a database error
749 * @link http://www.php.net/manual/en/mongodb.forceerror.php
750 * @return boolean Returns the database response.
751 */
752 public function forceError() {}
753
754 /**
755 * (PECL mongo >= 1.0.1)<br/>
756 * Log in to this database
757 * @link http://www.php.net/manual/en/mongodb.authenticate.php
758 * @param string $username The username.
759 * @param string $password The password (in plaintext).
760 * @return array <p>Returns database response. If the login was successful, it will return 1.</p>
761 * <p>
762 * <span style="color: #0000BB"><?php<br></span><span style="color: #007700">array(</span><span style="color: #DD0000">"ok" </span><span style="color: #007700">=> </span><span style="color: #0000BB">1</span><span style="color: #007700">);<br></span><span style="color: #0000BB">?></span>
763 * </span>
764 * </code></div>
765 * </div>
766 * </p>
767 * <p> If something went wrong, it will return </p>
768 * <p>
769 * <div class="example-contents">
770 * <div class="phpcode"><code><span style="color: #000000">
771 * <span style="color: #0000BB"><?php<br></span><span style="color: #007700">array(</span><span style="color: #DD0000">"ok" </span><span style="color: #007700">=> </span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #DD0000">"errmsg" </span><span style="color: #007700">=> </span><span style="color: #DD0000">"auth fails"</span><span style="color: #007700">);<br></span><span style="color: #0000BB">?></span></p>
772 * <p>("auth fails" could be another message, depending on database version and
773 * what went wrong)</p>
774 */
775 public function authenticate($username, $password) {}
776
777 /**
778 * (PECL mongo >= 1.3.0)<br/>
779 * Get the read preference for this database
780 * @link http://www.php.net/manual/en/mongodb.getreadpreference.php
781 * @return array This function returns an array describing the read preference. The array contains the values type for the string read preference mode (corresponding to the MongoClient constants), and tagsets containing a list of all tag set criteria. If no tag sets were specified, tagsets will not be present in the array.
782 */
783 public function getReadPreference () {}
784
785 /**
786 * (PECL mongo >= 1.3.0)<br/>
787 * Set the read preference for this database
788 * @link http://www.php.net/manual/en/mongodb.setreadpreference.php
789 * @param string $read_preference <p>The read preference mode: <b>MongoClient::RP_PRIMARY</b>, <b>MongoClient::RP_PRIMARY_PREFERRED</b>, <b>MongoClient::RP_SECONDARY</b>, <b>MongoClient::RP_SECONDARY_PREFERRED</b>, or <b>MongoClient::RP_NEAREST</b>.</p>
790 * @param array $tags [optional] <p>An array of zero or more tag sets, where each tag set is itself an array of criteria used to match tags on replica set members.</p>
791 * @return boolean Returns <b>TRUE</b> on success, or <b>FALSE</b> otherwise.
792 */
793 public function setReadPreference ($read_preference, array $tags) {}
794
795 /**
796 * (PECL mongo >= 1.5.0)<br/>
797 * @link https://php.net/manual/en/mongodb.setwriteconcern.php
798 * Set the write concern for this database
799 * @param mixed $w <p>The write concern. This may be an integer denoting the number of servers required to acknowledge the write, or a string mode (e.g. "majority").</p>
800 * @param int $wtimeout[optional] <p>The maximum number of milliseconds to wait for the server to satisfy the write concern.</p>
801 * @return boolean Returns <b>TRUE</b> on success, or <b>FALSE</b> otherwise.
802 */
803 public function setWriteConcern($w, $wtimeout) {}
804}
805
806/**
807 * Represents a database collection.
808 * @link http://www.php.net/manual/en/class.mongocollection.php
809 */
810class MongoCollection {
811 /**
812 * @link https://php.net/manual/en/class.mongocollection.php#mongocollection.constants.ascending
813 */
814 const ASCENDING = 1;
815
816 /**
817 * @link https://php.net/manual/en/class.mongocollection.php#mongocollection.constants.descending
818 */
819 const DESCENDING = -1;
820
821 /**
822 * @var MongoDB
823 */
824 public $db = NULL ;
825
826 /**
827 * @var int <p>
828 * The number of servers to replicate a change to before returning success.
829 * Value is inherited from the parent database. The
830 * {@link http://www.php.net/manual/en/class.mongodb.php MongoDB} class has a more detailed description of
831 * how <em>w</em> works.
832 * </p>
833 */
834 public $w;
835
836 /**
837 * @var int <p>
838 * The number of milliseconds to wait for <em>$this->w</em>
839 * replications to take place. Value is inherited from the parent database.
840 * The {@link http://www.php.net/manual/en/class.mongodb.php MongoDB} class has a more detailed description
841 * of how <em>wtimeout</em> works.
842 * </p>
843 */
844 public $wtimeout;
845
846 /**
847 * Creates a new collection
848 * @link http://www.php.net/manual/en/mongocollection.construct.php
849 * @param MongoDB $db Parent database.
850 * @param string $name Name for this collection.
851 * @throws Exception
852 */
853 public function __construct(MongoDB $db, $name) {}
854
855 /**
856 * String representation of this collection
857 * @link http://www.php.net/manual/en/mongocollection.--tostring.php
858 * @return string Returns the full name of this collection.
859 */
860 public function __toString() {}
861
862 /**
863 * Gets a collection
864 * @link http://www.php.net/manual/en/mongocollection.get.php
865 * @param string $name The next string in the collection name.
866 * @return MongoCollection
867 */
868 public function __get($name) {}
869
870 /**
871 * (PECL mongo >= 1.3.0)<br/>
872 * <p>
873 * The MongoDB
874 * {@link http://docs.mongodb.org/manual/applications/aggregation/ aggregation framework}
875 * provides a means to calculate aggregated values without having to use
876 * MapReduce. While MapReduce is powerful, it is often more difficult than
877 * necessary for many simple aggregation tasks, such as totaling or averaging
878 * field values.
879 * </p>
880 * <p>
881 * This method accepts either a variable amount of pipeline operators, or a
882 * single array of operators constituting the pipeline.
883 * </p>
884 * @link http://www.php.net/manual/en/mongocollection.aggregate.php
885 * @param array $pipeline <p> An array of pipeline operators, or just the first operator. </p>
886 * @param array $op [optional] <p> The second pipeline operator.</p>
887 * @param array $pipelineOperators [optional] <p> Additional pipeline operators. </p>
888 * @return array The result of the aggregation as an array. The ok will be set to 1 on success, 0 on failure.
889 */
890 public function aggregate ( array $pipeline, array $op, array $pipelineOperators ) {}
891
892 /**
893 * (PECL mongo >= 1.5.0)<br/>
894 *
895 * <p>
896 * With this method you can execute Aggregation Framework pipelines and retrieve the results
897 * through a cursor, instead of getting just one document back as you would with
898 * {@link https://php.net/manual/en/mongocollection.aggregate.php MongoCollection::aggregate()}.
899 * This method returns a {@link https://php.net/manual/en/class.mongocommandcursor.php MongoCommandCursor} object.
900 * This cursor object implements the {@link https://php.net/manual/en/class.iterator.php Iterator} interface
901 * just like the {@link https://php.net/manual/en/class.mongocursor.php MongoCursor} objects that are returned
902 * by the {@link https://php.net/manual/en/mongocollection.find.php MongoCollection::find()} method
903 * </p>
904 *
905 * @link https://php.net/manual/en/mongocollection.aggregatecursor.php
906 *
907 * @param array $pipeline <p> The Aggregation Framework pipeline to execute. </p>
908 * @param array $options [optional] <p> Options for the aggregation command </p>
909 *
910 * @return MongoCommandCursor Returns a {@link https://php.net/manual/en/class.mongocommandcursor.php MongoCommandCursor} object
911 */
912 public function aggregateCursor(array $pipeline, array $options) {}
913
914 /**
915 * Returns this collection's name
916 * @link http://www.php.net/manual/en/mongocollection.getname.php
917 * @return string
918 */
919 public function getName() {}
920
921 /**
922 * (PECL mongo >= 1.1.0)<br/>
923 * <p>
924 * See {@link http://www.php.net/manual/en/mongo.queries.php the query section} of this manual for
925 * information on distributing reads to secondaries.
926 * </p>
927 * @link http://www.php.net/manual/en/mongocollection.getslaveokay.php
928 * @return bool Returns the value of slaveOkay for this instance.
929 */
930 public function getSlaveOkay() { }
931
932 /**
933 * (PECL mongo >= 1.1.0)<br/>
934 * <p>
935 * See {@link http://www.php.net/manual/en/mongo.queries.php the query section} of this manual for
936 * information on distributing reads to secondaries.
937 * </p>
938 * @link http://www.php.net/manual/en/mongocollection.setslaveokay.php
939 * @param bool $ok [optional] <p>
940 * If reads should be sent to secondary members of a replica set for all
941 * possible queries using this {@link http://www.php.net/manual/en/class.mongocollection.php MongoCollection}
942 * instance.
943 * @return bool Returns the former value of slaveOkay for this instance.
944 * </p>
945 */
946 public function setSlaveOkay($ok = true) { }
947
948 /**
949 * (PECL mongo >= 1.3.0)<br/>
950 * @link http://www.php.net/manual/en/mongocollection.getreadpreference.php
951 * @return array This function returns an array describing the read preference. The array contains the values <em>type</em> for the string read preference mode
952 * (corresponding to the {@link http://www.php.net/manual/en/class.mongoclient.php MongoClient} constants), and <em>tagsets</em> containing a list of all tag set criteria. If no tag sets were specified, <em>tagsets</em> will not be present in the array.
953 */
954 public function getReadPreference() { }
955
956 /**
957 * (PECL mongo >= 1.3.0)<br/>
958 * @param string $read_preference <p>The read preference mode: <b>MongoClient::RP_PRIMARY</b>, <b>MongoClient::RP_PRIMARY_PREFERRED</b>, <b>MongoClient::RP_SECONDARY</b>, <b>MongoClient::RP_SECONDARY_PREFERRED</b>, or <b>MongoClient::RP_NEAREST</b>.</p>
959 * @param array $tags [optional] <p>An array of zero or more tag sets, where each tag set is itself an array of criteria used to match tags on replica set members.<p>
960 * @return bool Returns <b>TRUE</b> on success, or <b>FALSE</b> otherwise.
961 */
962 public function setReadPreference($read_preference, array $tags) { }
963
964 /**
965 * Drops this collection
966 * @link http://www.php.net/manual/en/mongocollection.drop.php
967 * @return array Returns the database response.
968 */
969 public function drop() {}
970
971 /**
972 * Validates this collection
973 * @link http://www.php.net/manual/en/mongocollection.validate.php
974 * @param bool $scan_data Only validate indices, not the base collection.
975 * @return array Returns the database's evaluation of this object.
976 */
977 public function validate($scan_data = FALSE) {}
978
979 /**
980 * Inserts an array into the collection
981 * @link http://www.php.net/manual/en/mongocollection.insert.php
982 * @param array|object $a An array or object. If an object is used, it may not have protected or private properties.
983 * Note: If the parameter does not have an _id key or property, a new MongoId instance will be created and assigned to it.
984 * This special behavior does not mean that the parameter is passed by reference.
985 * @param array $options Options for the insert.
986 * <dl>
987 * <dt>"w"
988 * <dd>See WriteConcerns. The default value for MongoClient is 1.
989 * <dt>"fsync"
990 * <dd>Boolean, defaults to FALSE. Forces the insert to be synced to disk before returning success. If TRUE, an acknowledged insert is implied and will override setting w to 0.
991 * <dt>"timeout"
992 * <dd>Integer, defaults to MongoCursor::$timeout. If "safe" is set, this sets how long (in milliseconds) for the client to wait for a database response. If the database does not respond within the timeout period, a MongoCursorTimeoutException will be thrown.
993 * <dt>"safe"
994 * <dd>Deprecated. Please use the WriteConcern w option.
995 * </dl>
996 * @throws MongoException if the inserted document is empty or if it contains zero-length keys. Attempting to insert an object with protected and private properties will cause a zero-length key error.
997 * @throws MongoCursorException if the "w" option is set and the write fails.
998 * @throws MongoCursorTimeoutException if the "w" option is set to a value greater than one and the operation takes longer than MongoCursor::$timeout milliseconds to complete. This does not kill the operation on the server, it is a client-side timeout. The operation in MongoCollection::$wtimeout is milliseconds.
999 * @return bool|array Returns an array containing the status of the insertion if the "w" option is set.
1000 * Otherwise, returns TRUE if the inserted array is not empty (a MongoException will be thrown if the inserted array is empty).
1001 * If an array is returned, the following keys may be present:
1002 * <dl>
1003 * <dt>ok
1004 * <dd>This should almost be 1 (unless last_error itself failed).
1005 * <dt>err
1006 * <dd>If this field is non-null, an error occurred on the previous operation. If this field is set, it will be a string describing the error that occurred.
1007 * <dt>code
1008 * <dd>If a database error occurred, the relevant error code will be passed back to the client.
1009 * <dt>errmsg
1010 * <dd>This field is set if something goes wrong with a database command. It is coupled with ok being 0. For example, if w is set and times out, errmsg will be set to "timed out waiting for slaves" and ok will be 0. If this field is set, it will be a string describing the error that occurred.
1011 * <dt>n
1012 * <dd>If the last operation was an update, upsert, or a remove, the number of documents affected will be returned. For insert operations, this value is always 0.
1013 * <dt>wtimeout
1014 * <dd>If the previous option timed out waiting for replication.
1015 * <dt>waited
1016 * <dd>How long the operation waited before timing out.
1017 * <dt>wtime
1018 * <dd>If w was set and the operation succeeded, how long it took to replicate to w servers.
1019 * <dt>upserted
1020 * <dd>If an upsert occurred, this field will contain the new record's _id field. For upserts, either this field or updatedExisting will be present (unless an error occurred).
1021 * <dt>updatedExisting
1022 * <dd>If an upsert updated an existing element, this field will be true. For upserts, either this field or upserted will be present (unless an error occurred).
1023 * </dl>
1024 */
1025 public function insert($a, array $options = array()) {}
1026
1027 /**
1028 * Inserts multiple documents into this collection
1029 * @link http://www.php.net/manual/en/mongocollection.batchinsert.php
1030 * @param array $a An array of arrays.
1031 * @param array $options Options for the inserts.
1032 * @throws MongoCursorException
1033 * @return mixed f "safe" is set, returns an associative array with the status of the inserts ("ok") and any error that may have occured ("err"). Otherwise, returns TRUE if the batch insert was successfully sent, FALSE otherwise.
1034 */
1035 public function batchInsert(array $a, array $options = array()) {}
1036
1037 /**
1038 * Update records based on a given criteria
1039 * @link http://www.php.net/manual/en/mongocollection.update.php
1040 * @param array $criteria Description of the objects to update.
1041 * @param array $newobj The object with which to update the matching records.
1042 * @param array $options This parameter is an associative array of the form
1043 * array("optionname" => boolean, ...).
1044 *
1045 * Currently supported options are:
1046 * "upsert": If no document matches $$criteria, a new document will be created from $$criteria and $$new_object (see upsert example).
1047 *
1048 * "multiple": All documents matching $criteria will be updated. MongoCollection::update has exactly the opposite behavior of MongoCollection::remove- it updates one document by
1049 * default, not all matching documents. It is recommended that you always specify whether you want to update multiple documents or a single document, as the
1050 * database may change its default behavior at some point in the future.
1051 *
1052 * "safe" Can be a boolean or integer, defaults to false. If false, the program continues executing without waiting for a database response. If true, the program will wait for
1053 * the database response and throw a MongoCursorException if the update did not succeed. If you are using replication and the master has changed, using "safe" will make the driver
1054 * disconnect from the master, throw and exception, and attempt to find a new master on the next operation (your application must decide whether or not to retry the operation on the new master).
1055 * If you do not use "safe" with a replica set and the master changes, there will be no way for the driver to know about the change so it will continuously and silently fail to write.
1056 * If safe is an integer, will replicate the update to that many machines before returning success (or throw an exception if the replication times out, see wtimeout).
1057 * This overrides the w variable set on the collection.
1058 *
1059 * "fsync": Boolean, defaults to false. Forces the update to be synced to disk before returning success. If true, a safe update is implied and will override setting safe to false.
1060 *
1061 * "timeout" Integer, defaults to MongoCursor::$timeout. If "safe" is set, this sets how long (in milliseconds) for the client to wait for a database response. If the database does
1062 * not respond within the timeout period, a MongoCursorTimeoutException will be thrown
1063 * @throws MongoCursorException
1064 * @return boolean
1065 */
1066 public function update(array $criteria , array $newobj, array $options = array()) {}
1067
1068 /**
1069 * (PECL mongo >= 0.9.0)<br/>
1070 * Remove records from this collection
1071 * @link http://www.php.net/manual/en/mongocollection.remove.php
1072 * @param array $criteria [optional] <p>Query criteria for the documents to delete.</p>
1073 * @param array $options [optional] <p>An array of options for the remove operation. Currently available options
1074 * include:
1075 * </p><ul>
1076 * <li><p><em>"w"</em></p><p>See {@link http://www.php.net/manual/en/mongo.writeconcerns.php Write Concerns}. The default value for <b>MongoClient</b> is <em>1</em>.</p></li>
1077 * <li>
1078 * <p>
1079 * <em>"justOne"</em>
1080 * </p>
1081 * <p>
1082 * Specify <strong><code>TRUE</code></strong> to limit deletion to just one document. If <strong><code>FALSE</code></strong> or
1083 * omitted, all documents matching the criteria will be deleted.
1084 * </p>
1085 * </li>
1086 * <li><p><em>"fsync"</em></p><p>Boolean, defaults to <b>FALSE</b>. If journaling is enabled, it works exactly like <em>"j"</em>. If journaling is not enabled, the write operation blocks until it is synced to database files on disk. If <strong><code>TRUE</code></strong>, an acknowledged insert is implied and this option will override setting <em>"w"</em> to <em>0</em>.</p><blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">If journaling is enabled, users are strongly encouraged to use the <em>"j"</em> option instead of <em>"fsync"</em>. Do not use <em>"fsync"</em> and <em>"j"</em> simultaneously, as that will result in an error.</p></blockquote></li>
1087 * <li><p><em>"j"</em></p><p>Boolean, defaults to <b>FALSE</b>. Forces the write operation to block until it is synced to the journal on disk. If <strong><code>TRUE</code></strong>, an acknowledged write is implied and this option will override setting <em>"w"</em> to <em>0</em>.</p><blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">If this option is used and journaling is disabled, MongoDB 2.6+ will raise an error and the write will fail; older server versions will simply ignore the option.</p></blockquote></li>
1088 * <li><p><em>"socketTimeoutMS"</em></p><p>This option specifies the time limit, in milliseconds, for socket communication. If the server does not respond within the timeout period, a <b>MongoCursorTimeoutException</b> will be thrown and there will be no way to determine if the server actually handled the write or not. A value of <em>-1</em> may be specified to block indefinitely. The default value for <b>MongoClient</b> is <em>30000</em> (30 seconds).</p></li>
1089 * <li><p><em>"w"</em></p><p>See {@link http://www.php.net/manual/en/mongo.writeconcerns.php Write Concerns }. The default value for <b>MongoClient</b> is <em>1</em>.</p></li>
1090 * <li><p><em>"wTimeoutMS"</em></p><p>This option specifies the time limit, in milliseconds, for {@link http://www.php.net/manual/en/mongo.writeconcerns.php write concern} acknowledgement. It is only applicable when <em>"w"</em> is greater than <em>1</em>, as the timeout pertains to replication. If the write concern is not satisfied within the time limit, a <a href="class.mongocursorexception.php" class="classname">MongoCursorException</a> will be thrown. A value of <em>0</em> may be specified to block indefinitely. The default value for {@link http://www.php.net/manual/en/class.mongoclient.php MongoClient} is <em>10000</em> (ten seconds).</p></li>
1091 * </ul>
1092 *
1093 * <p>
1094 * The following options are deprecated and should no longer be used:
1095 * </p><ul>
1096 * <li><p><em>"safe"</em></p><p>Deprecated. Please use the {@link http://www.php.net/manual/en/mongo.writeconcerns.php write concern} <em>"w"</em> option.</p></li>
1097 * <li><p><em>"timeout"</em></p><p>Deprecated alias for <em>"socketTimeoutMS"</em>.</p></li>
1098 * <li><p><b>"wtimeout"</b></p><p>Deprecated alias for <em>"wTimeoutMS"</em>.</p></p>
1099 * @throws MongoCursorException
1100 * @throws MongoCursorTimeoutException
1101 * @return bool|array <p>Returns an array containing the status of the removal if the
1102 * <em>"w"</em> option is set. Otherwise, returns <b>TRUE</b>.
1103 * </p>
1104 * <p>
1105 * Fields in the status array are described in the documentation for
1106 * <b>MongoCollection::insert()</b>.
1107 * </p>
1108 */
1109 public function remove(array $criteria = array(), array $options = array()) {}
1110
1111 /**
1112 * Querys this collection
1113 * @link http://www.php.net/manual/en/mongocollection.find.php
1114 * @param array $query The fields for which to search.
1115 * @param array $fields Fields of the results to return.
1116 * @return MongoCursor
1117 */
1118 public function find(array $query = array(), array $fields = array()) {}
1119
1120 /**
1121 * Retrieve a list of distinct values for the given key across a collection
1122 * @link http://www.php.net/manual/ru/mongocollection.distinct.php
1123 * @param string $key The key to use.
1124 * @param array $query An optional query parameters
1125 * @return array|bool Returns an array of distinct values, or <b>FALSE</b> on failure
1126 */
1127 public function distinct ($key, array $query = NULL) {}
1128
1129 /**
1130 * Update a document and return it
1131 * @link http://www.php.net/manual/ru/mongocollection.findandmodify.php
1132 * @param array $query The query criteria to search for.
1133 * @param array $update The update criteria.
1134 * @param array $fields Optionally only return these fields.
1135 * @param array $options An array of options to apply, such as remove the match document from the DB and return it.
1136 * @return array Returns the original document, or the modified document when new is set.
1137 */
1138 public function findAndModify (array $query, array $update = NULL, array $fields = NULL, array $options = NULL) {}
1139
1140 /**
1141 * Querys this collection, returning a single element
1142 * @link http://www.php.net/manual/en/mongocollection.findone.php
1143 * @param array $query The fields for which to search.
1144 * @param array $fields Fields of the results to return.
1145 * @param array $options This parameter is an associative array of the form array("name" => <value>, ...).
1146 * @return array|null
1147 */
1148 public function findOne(array $query = array(), array $fields = array(), array $options = array()) {}
1149
1150 /**
1151 * Creates an index on the given field(s), or does nothing if the index already exists
1152 * @link http://www.php.net/manual/en/mongocollection.createindex.php
1153 * @param array $keys Field or fields to use as index.
1154 * @param array $options [optional] This parameter is an associative array of the form array("optionname" => <boolean>, ...).
1155 * @return array Returns the database response.
1156 */
1157 public function createIndex(array $keys, array $options = array()) {}
1158
1159 /**
1160 * @deprecated Use MongoCollection::createIndex() instead.
1161 * Creates an index on the given field(s), or does nothing if the index already exists
1162 * @link http://www.php.net/manual/en/mongocollection.ensureindex.php
1163 * @param array $keys Field or fields to use as index.
1164 * @param array $options [optional] This parameter is an associative array of the form array("optionname" => <boolean>, ...).
1165 * @return boolean always true
1166 */
1167 public function ensureIndex(array $keys, array $options = array()) {}
1168
1169 /**
1170 * Deletes an index from this collection
1171 * @link http://www.php.net/manual/en/mongocollection.deleteindex.php
1172 * @param string|array $keys Field or fields from which to delete the index.
1173 * @return array Returns the database response.
1174 */
1175 public function deleteIndex($keys) {}
1176
1177 /**
1178 * Delete all indexes for this collection
1179 * @link http://www.php.net/manual/en/mongocollection.deleteindexes.php
1180 * @return array Returns the database response.
1181 */
1182 public function deleteIndexes() {}
1183
1184 /**
1185 * Returns an array of index names for this collection
1186 * @link http://www.php.net/manual/en/mongocollection.getindexinfo.php
1187 * @return array Returns a list of index names.
1188 */
1189 public function getIndexInfo() {}
1190
1191 /**
1192 * Counts the number of documents in this collection
1193 * @link http://www.php.net/manual/en/mongocollection.count.php
1194 * @param array|stdClass $query
1195 * @return int Returns the number of documents matching the query.
1196 */
1197 public function count($query = array()) {}
1198
1199 /**
1200 * Saves an object to this collection
1201 * @link http://www.php.net/manual/en/mongocollection.save.php
1202 * @param array|object $a Array to save. If an object is used, it may not have protected or private properties.
1203 * Note: If the parameter does not have an _id key or property, a new MongoId instance will be created and assigned to it.
1204 * See MongoCollection::insert() for additional information on this behavior.
1205 * @param array $options Options for the save.
1206 * <dl>
1207 * <dt>"w"
1208 * <dd>See WriteConcerns. The default value for MongoClient is 1.
1209 * <dt>"fsync"
1210 * <dd>Boolean, defaults to FALSE. Forces the insert to be synced to disk before returning success. If TRUE, an acknowledged insert is implied and will override setting w to 0.
1211 * <dt>"timeout"
1212 * <dd>Integer, defaults to MongoCursor::$timeout. If "safe" is set, this sets how long (in milliseconds) for the client to wait for a database response. If the database does not respond within the timeout period, a MongoCursorTimeoutException will be thrown.
1213 * <dt>"safe"
1214 * <dd>Deprecated. Please use the WriteConcern w option.
1215 * </dl>
1216 * @throws MongoException if the inserted document is empty or if it contains zero-length keys. Attempting to insert an object with protected and private properties will cause a zero-length key error.
1217 * @throws MongoCursorException if the "w" option is set and the write fails.
1218 * @throws MongoCursorTimeoutException if the "w" option is set to a value greater than one and the operation takes longer than MongoCursor::$timeout milliseconds to complete. This does not kill the operation on the server, it is a client-side timeout. The operation in MongoCollection::$wtimeout is milliseconds.
1219 * @return array|boolean If w was set, returns an array containing the status of the save.
1220 * Otherwise, returns a boolean representing if the array was not empty (an empty array will not be inserted).
1221 */
1222 public function save($a, array $options = array()) {}
1223
1224 /**
1225 * Creates a database reference
1226 * @link http://www.php.net/manual/en/mongocollection.createdbref.php
1227 * @param array $a Object to which to create a reference.
1228 * @return array Returns a database reference array.
1229 */
1230 public function createDBRef(array $a) {}
1231
1232 /**
1233 * Fetches the document pointed to by a database reference
1234 * @link http://www.php.net/manual/en/mongocollection.getdbref.php
1235 * @param array $ref A database reference.
1236 * @return array Returns the database document pointed to by the reference.
1237 */
1238 public function getDBRef(array $ref) {}
1239
1240 /**
1241 * @param mixed $keys
1242 * @static
1243 * @return string
1244 */
1245 protected static function toIndexString($keys) {}
1246
1247 /**
1248 * Performs an operation similar to SQL's GROUP BY command
1249 * @link http://www.php.net/manual/en/mongocollection.group.php
1250 * @param mixed $keys Fields to group by. If an array or non-code object is passed, it will be the key used to group results.
1251 * @param array $initial Initial value of the aggregation counter object.
1252 * @param MongoCode $reduce A function that aggregates (reduces) the objects iterated.
1253 * @param array $condition An condition that must be true for a row to be considered.
1254 * @return array
1255 */
1256 public function group($keys, array $initial, MongoCode $reduce, array $condition = array()) {}
1257}
1258
1259/**
1260 * Result object for database query.
1261 * @link http://www.php.net/manual/en/class.mongocursor.php
1262 */
1263class MongoCursor implements Iterator {
1264 /**
1265 * @link https://php.net/manual/en/class.mongocursor.php#mongocursor.props.slaveokay
1266 * @static
1267 * @var bool $slaveOkay
1268 */
1269 public static $slaveOkay = FALSE;
1270
1271 /**
1272 * @var int <p>
1273 * Set timeout in milliseconds for all database responses. Use
1274 * <em>-1</em> to wait forever. Can be overridden with
1275 * {link http://php.net/manual/en/mongocursor.timeout.php MongoCursor::timeout()}. This does not cause the
1276 * MongoDB server to cancel the operation; it only instructs the driver to
1277 * stop waiting for a response and throw a
1278 * {@link https://php.net/manual/en/class.mongocursortimeoutexception.php MongoCursorTimeoutException} after a set time.
1279 * </p>
1280 */
1281 static $timeout = 30000;
1282 /**
1283 * Create a new cursor
1284 * @link http://www.php.net/manual/en/mongocursor.construct.php
1285 * @param MongoClient $connection Database connection.
1286 * @param string $ns Full name of database and collection.
1287 * @param array $query Database query.
1288 * @param array $fields Fields to return.
1289 */
1290 public function __construct($connection, $ns, array $query = array(), array $fields = array()) {}
1291
1292 /**
1293 * (PECL mongo >= 1.2.11)<br/>
1294 * Sets whether this cursor will wait for a while for a tailable cursor to return more data
1295 * @param bool $wait [optional] <p>If the cursor should wait for more data to become available.</p>
1296 * @return MongoCursor Returns this cursor.
1297 */
1298 public function awaitData ($wait = true) {}
1299 /**
1300 * Checks if there are any more elements in this cursor
1301 * @link http://www.php.net/manual/en/mongocursor.hasnext.php
1302 * @throws MongoConnectionException
1303 * @throws MongoCursorTimeoutException
1304 * @return bool Returns true if there is another element
1305 */
1306 public function hasNext() {}
1307
1308 /**
1309 * Return the next object to which this cursor points, and advance the cursor
1310 * @link http://www.php.net/manual/en/mongocursor.getnext.php
1311 * @throws MongoConnectionException
1312 * @throws MongoCursorTimeoutException
1313 * @return array Returns the next object
1314 */
1315 public function getNext() {}
1316
1317 /**
1318 * (PECL mongo >= 1.3.3)<br/>
1319 * @link http://www.php.net/manual/en/mongocursor.getreadpreference.php
1320 * @return array This function returns an array describing the read preference. The array contains the values <em>type</em> for the string
1321 * read preference mode (corresponding to the {@link http://www.php.net/manual/en/class.mongoclient.php MongoClient} constants), and <em>tagsets</em> containing a list of all tag set criteria. If no tag sets were specified, <em>tagsets</em> will not be present in the array.
1322 */
1323 public function getReadPreference () { }
1324
1325 /**
1326 * Limits the number of results returned
1327 * @link http://www.php.net/manual/en/mongocursor.limit.php
1328 * @param int $num The number of results to return.
1329 * @throws MongoCursorException
1330 * @return MongoCursor Returns this cursor
1331 */
1332 public function limit($num) {}
1333
1334 /**
1335 * (PECL mongo >= 1.2.0)<br/>
1336 * @link http://www.php.net/manual/en/mongocursor.partial.php
1337 * @param bool $okay [optional] <p>If receiving partial results is okay.</p>
1338 * @return MongoCursor Returns this cursor.
1339 */
1340 public function partial ($okay = true) {}
1341
1342 /**
1343 * (PECL mongo >= 1.2.1)<br/>
1344 * @link http://www.php.net/manual/en/mongocursor.setflag.php
1345 * @param int $flag <p>
1346 * Which flag to set. You can not set flag 6 (EXHAUST) as the driver does
1347 * not know how to handle them. You will get a warning if you try to use
1348 * this flag. For available flags, please refer to the wire protocol
1349 * {@link http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol#MongoWireProtocol-OPQUERY documentation}.
1350 * </p>
1351 * @param bool $set [optional] <p>Whether the flag should be set (<b>TRUE</b>) or unset (<b>FALSE</b>).</p>
1352 * @return MongoCursor
1353 */
1354 public function setFlag ($flag, $set = true ) {}
1355
1356 /**
1357 * (PECL mongo >= 1.3.3)<br/>
1358 * @link http://www.php.net/manual/en/mongocursor.setreadpreference.php
1359 * @param string $read_preference <p>The read preference mode: MongoClient::RP_PRIMARY, MongoClient::RP_PRIMARY_PREFERRED, MongoClient::RP_SECONDARY, MongoClient::RP_SECONDARY_PREFERRED, or MongoClient::RP_NEAREST.</p>
1360 * @param array $tags [optional] <p>The read preference mode: MongoClient::RP_PRIMARY, MongoClient::RP_PRIMARY_PREFERRED, MongoClient::RP_SECONDARY, MongoClient::RP_SECONDARY_PREFERRED, or MongoClient::RP_NEAREST.</p>
1361 * @return MongoCursor Returns this cursor.
1362 */
1363 public function setReadPreference ($read_preference, array $tags) {}
1364
1365 /**
1366 * Skips a number of results
1367 * @link http://www.php.net/manual/en/mongocursor.skip.php
1368 * @param int $num The number of results to skip.
1369 * @throws MongoCursorException
1370 * @return MongoCursor Returns this cursor
1371 */
1372 public function skip($num) {}
1373
1374 /**
1375 * Sets whether this query can be done on a slave
1376 * This method will override the static class variable slaveOkay.
1377 * @link http://www.php.net/manual/en/mongocursor.slaveOkay.php
1378 * @param boolean $okay If it is okay to query the slave.
1379 * @throws MongoCursorException
1380 * @return MongoCursor Returns this cursor
1381 */
1382 public function slaveOkay($okay = true) {}
1383
1384 /**
1385 * Sets whether this cursor will be left open after fetching the last results
1386 * @link http://www.php.net/manual/en/mongocursor.tailable.php
1387 * @param bool $tail If the cursor should be tailable.
1388 * @return MongoCursor Returns this cursor
1389 */
1390 public function tailable($tail = true) {}
1391
1392 /**
1393 * Sets whether this cursor will timeout
1394 * @link http://www.php.net/manual/en/mongocursor.immortal.php
1395 * @param bool $liveForever If the cursor should be immortal.
1396 * @throws MongoCursorException
1397 * @return MongoCursor Returns this cursor
1398 */
1399 public function immortal($liveForever = true) {}
1400
1401 /**
1402 * Sets a client-side timeout for this query
1403 * @link http://www.php.net/manual/en/mongocursor.timeout.php
1404 * @param int $ms The number of milliseconds for the cursor to wait for a response. By default, the cursor will wait forever.
1405 * @throws MongoCursorTimeoutException
1406 * @return MongoCursor Returns this cursor
1407 */
1408 public function timeout($ms) {}
1409
1410 /**
1411 * Checks if there are documents that have not been sent yet from the database for this cursor
1412 * @link http://www.php.net/manual/en/mongocursor.dead.php
1413 * @return boolean Returns if there are more results that have not been sent to the client, yet.
1414 */
1415 public function dead() {}
1416
1417 /**
1418 * Use snapshot mode for the query
1419 * @link http://www.php.net/manual/en/mongocursor.snapshot.php
1420 * @throws MongoCursorException
1421 * @return MongoCursor Returns this cursor
1422 */
1423 public function snapshot() {}
1424
1425 /**
1426 * Sorts the results by given fields
1427 * @link http://www.php.net/manual/en/mongocursor.sort.php
1428 * @param array $fields An array of fields by which to sort. Each element in the array has as key the field name, and as value either 1 for ascending sort, or -1 for descending sort
1429 * @throws MongoCursorException
1430 * @return MongoCursor Returns the same cursor that this method was called on
1431 */
1432 public function sort(array $fields) {}
1433
1434 /**
1435 * Gives the database a hint about the query
1436 * @link http://www.php.net/manual/en/mongocursor.hint.php
1437 * @param mixed $key_pattern Indexes to use for the query.
1438 * @throws MongoCursorException
1439 * @return MongoCursor Returns this cursor
1440 */
1441 public function hint(mixed $key_pattern) {}
1442
1443
1444 /**
1445 * Adds a top-level key/value pair to a query
1446 * @link http://www.php.net/manual/en/mongocursor.addoption.php
1447 * @param string $key Fieldname to add.
1448 * @param mixed $value Value to add.
1449 * @throws MongoCursorException
1450 * @return MongoCursor Returns this cursor
1451 */
1452 public function addOption($key, $value) {}
1453
1454 /**
1455 * Execute the query
1456 * @link http://www.php.net/manual/en/mongocursor.doquery.php
1457 * @throws MongoConnectionException if it cannot reach the database.
1458 * @return void
1459 */
1460 protected function doQuery() {}
1461
1462 /**
1463 * Returns the current element
1464 * @link http://www.php.net/manual/en/mongocursor.current.php
1465 * @return array
1466 */
1467 public function current() {}
1468
1469 /**
1470 * Returns the current result's _id
1471 * @link http://www.php.net/manual/en/mongocursor.key.php
1472 * @return string The current result's _id as a string.
1473 */
1474 public function key() {}
1475
1476 /**
1477 * Advances the cursor to the next result
1478 * @link http://www.php.net/manual/en/mongocursor.next.php
1479 * @throws MongoConnectionException
1480 * @throws MongoCursorTimeoutException
1481 * @return void
1482 */
1483 public function next() {}
1484
1485 /**
1486 * Returns the cursor to the beginning of the result set
1487 * @throws MongoConnectionException
1488 * @throws MongoCursorTimeoutException
1489 * @return void
1490 */
1491 public function rewind() {}
1492
1493 /**
1494 * Checks if the cursor is reading a valid result.
1495 * @link http://www.php.net/manual/en/mongocursor.valid.php
1496 * @return boolean If the current result is not null.
1497 */
1498 public function valid() {}
1499
1500 /**
1501 * Clears the cursor
1502 * @link http://www.php.net/manual/en/mongocursor.reset.php
1503 * @return void
1504 */
1505 public function reset() {}
1506
1507 /**
1508 * Return an explanation of the query, often useful for optimization and debugging
1509 * @link http://www.php.net/manual/en/mongocursor.explain.php
1510 * @return array Returns an explanation of the query.
1511 */
1512 public function explain() {}
1513
1514 /**
1515 * Counts the number of results for this query
1516 * @link http://www.php.net/manual/en/mongocursor.count.php
1517 * @param bool $all Send cursor limit and skip information to the count function, if applicable.
1518 * @return int The number of documents returned by this cursor's query.
1519 */
1520 public function count($all = FALSE) {}
1521
1522 /**
1523 * Sets the fields for a query
1524 * @link http://www.php.net/manual/en/mongocursor.fields.php
1525 * @param array $f Fields to return (or not return).
1526 * @throws MongoCursorException
1527 * @return MongoCursor
1528 */
1529 public function fields(array $f){}
1530
1531 /**
1532 * Gets the query, fields, limit, and skip for this cursor
1533 * @link http://www.php.net/manual/en/mongocursor.info.php
1534 * @return array The query, fields, limit, and skip for this cursor as an associative array.
1535 */
1536 public function info(){}
1537
1538 /**
1539 * PECL mongo >=1.0.11
1540 * Limits the number of elements returned in one batch.
1541 * <p>A cursor typically fetches a batch of result objects and store them locally.
1542 * This method sets the batchSize value to configure the amount of documents retrieved from the server in one data packet.
1543 * However, it will never return more documents than fit in the max batch size limit (usually 4MB).
1544 *
1545 * @param int $batchSize The number of results to return per batch. Each batch requires a round-trip to the server.
1546 * <p>If batchSize is 2 or more, it represents the size of each batch of objects retrieved.
1547 * It can be adjusted to optimize performance and limit data transfer.
1548 *
1549 * <p>If batchSize is 1 or negative, it will limit of number returned documents to the absolute value of batchSize,
1550 * and the cursor will be closed. For example if batchSize is -10, then the server will return a maximum of 10
1551 * documents and as many as can fit in 4MB, then close the cursor.
1552 * <b>Warning</b>
1553 * <p>A batchSize of 1 is special, and means the same as -1, i.e. a value of 1 makes the cursor only capable of returning one document.
1554 * <p>Note that this feature is different from MongoCursor::limit() in that documents must fit within a maximum size,
1555 * and it removes the need to send a request to close the cursor server-side.
1556 * The batch size can be changed even after a cursor is iterated, in which case the setting will apply on the next batch retrieval.
1557 * <p>This cannot override MongoDB's limit on the amount of data it will return to the client (i.e.,
1558 * if you set batch size to 1,000,000,000, MongoDB will still only return 4-16MB of results per batch).
1559 * <p>To ensure consistent behavior, the rules of MongoCursor::batchSize() and MongoCursor::limit() behave a little complex
1560 * but work "as expected". The rules are: hard limits override soft limits with preference given to MongoCursor::limit() over
1561 * MongoCursor::batchSize(). After that, whichever is set and lower than the other will take precedence.
1562 * See below. section for some examples.
1563 * @return MongoCursor Returns this cursor.
1564 * @link http://docs.php.net/manual/en/mongocursor.batchsize.php
1565 */
1566 public function batchSize($batchSize){}
1567
1568 /**
1569 * (PECL mongo >=1.5.0)
1570 * Sets a server-side timeout for this query
1571 * @link https://php.net/manual/en/mongocursor.maxtimems.php
1572 * @param int $ms <p>
1573 * Specifies a cumulative time limit in milliseconds to be allowed by the
1574 * server for processing operations on the cursor.
1575 * </p>
1576 * @return MongoCursor This cursor.
1577 */
1578 public function maxTimeMS ($ms) {}
1579}
1580
1581class MongoCommandCursor implements MongoCursorInterface {
1582 /**
1583 * Return the current element
1584 * @link https://php.net/manual/en/iterator.current.php
1585 * @return mixed Can return any type.
1586 * @since 5.0.0
1587 */
1588 public function current(){}
1589
1590 /**
1591 * Move forward to next element
1592 * @link https://php.net/manual/en/iterator.next.php
1593 * @return void Any returned value is ignored.
1594 * @since 5.0.0
1595 */
1596 public function next(){}
1597
1598 /**
1599 * Return the key of the current element
1600 * @link https://php.net/manual/en/iterator.key.php
1601 * @return mixed scalar on success, or null on failure.
1602 * @since 5.0.0
1603 */
1604 public function key(){}
1605
1606 /**
1607 * Checks if current position is valid
1608 * @link https://php.net/manual/en/iterator.valid.php
1609 * @return boolean The return value will be casted to boolean and then evaluated.
1610 * Returns true on success or false on failure.
1611 * @since 5.0.0
1612 */
1613 public function valid(){}
1614
1615 /**
1616 * Rewind the Iterator to the first element
1617 * @link https://php.net/manual/en/iterator.rewind.php
1618 * @return void Any returned value is ignored.
1619 * @since 5.0.0
1620 */
1621 public function rewind(){}
1622
1623 function batchSize(int $batchSize):MongoCursorInterface{}
1624
1625 function dead():bool{}
1626
1627 function info():array{}
1628
1629 function getReadPreference():array{}
1630
1631 function setReadPreference(string $read_preference, array $tags = null):MongoCursorInterface{}
1632
1633 function timeout(int $ms):MongoCursorInterface{}
1634}
1635
1636interface MongoCursorInterface extends Iterator
1637{
1638 function batchSize(int $batchSize):MongoCursorInterface;
1639
1640 function dead():bool;
1641
1642 function info():array;
1643
1644 function getReadPreference():array;
1645
1646 function setReadPreference(string $read_preference, array $tags = null):MongoCursorInterface;
1647
1648 function timeout(int $ms):MongoCursorInterface;
1649}
1650
1651/**
1652 *
1653 */
1654class MongoGridFS extends MongoCollection {
1655 const ASCENDING = 1;
1656 const DESCENDING = -1;
1657
1658 /**
1659 * @link https://php.net/manual/en/class.mongogridfs.php#mongogridfs.props.chunks
1660 * @var $chunks MongoCollection
1661 */
1662 public $chunks;
1663
1664 /**
1665 * @link https://php.net/manual/en/class.mongogridfs.php#mongogridfs.props.filesname
1666 * @var $filesName string
1667 */
1668 protected $filesName;
1669
1670 /**
1671 * @link https://php.net/manual/en/class.mongogridfs.php#mongogridfs.props.chunksname
1672 * @var $chunksName string
1673 */
1674 protected $chunksName;
1675
1676
1677
1678 /**
1679 * Files as stored across two collections, the first containing file meta
1680 * information, the second containing chunks of the actual file. By default,
1681 * fs.files and fs.chunks are the collection names used.
1682 *
1683 * @link https://php.net/manual/en/mongogridfs.construct.php
1684 * @param MongoDB $db Database
1685 * @param string $prefix [optional] <p>Optional collection name prefix.</p>
1686 * @param mixed $chunks [optional]
1687 */
1688 public function __construct($db, $prefix = "fs", $chunks = "fs") {}
1689
1690 /**
1691 * Drops the files and chunks collections
1692 * @link https://php.net/manual/en/mongogridfs.drop.php
1693 * @return array The database response
1694 */
1695 public function drop() {}
1696
1697 /**
1698 * @link https://php.net/manual/en/mongogridfs.find.php
1699 * @param array $query The query
1700 * @param array $fields Fields to return
1701 * @return MongoGridFSCursor A MongoGridFSCursor
1702 */
1703 public function find(array $query = array(), array $fields = array()) {}
1704
1705 /**
1706 * Stores a file in the database
1707 * @link https://php.net/manual/en/mongogridfs.storefile.php
1708 * @param string $filename The name of the file
1709 * @param array $extra Other metadata to add to the file saved
1710 * @param array $options Options for the store. "safe": Check that this store succeeded
1711 * @return mixed Returns the _id of the saved object
1712 */
1713 public function storeFile($filename, $extra = array(), $options = array()) {}
1714
1715 /**
1716 * Chunkifies and stores bytes in the database
1717 * @link https://php.net/manual/en/mongogridfs.storebytes.php
1718 * @param string $bytes A string of bytes to store
1719 * @param array $extra Other metadata to add to the file saved
1720 * @param array $options Options for the store. "safe": Check that this store succeeded
1721 * @return mixed The _id of the object saved
1722 */
1723 public function storeBytes($bytes, $extra = array(), $options = array()) {}
1724
1725 /**
1726 * Returns a single file matching the criteria
1727 * @link http://www.php.net/manual/en/mongogridfs.findone.php
1728 * @param array $query The fields for which to search.
1729 * @param array $fields Fields of the results to return.
1730 * @return MongoGridFSFile|null
1731 */
1732 public function findOne(array $query = array(), array $fields = array()) {}
1733
1734 /**
1735 * Removes files from the collections
1736 * @link http://www.php.net/manual/en/mongogridfs.remove.php
1737 * @param array $criteria Description of records to remove.
1738 * @param array $options Options for remove. Valid options are: "safe"- Check that the remove succeeded.
1739 * @throws MongoCursorException
1740 * @return boolean
1741 */
1742 public function remove(array $criteria = array(), array $options = array()) {}
1743
1744 /**
1745 * Delete a file from the database
1746 * @link https://php.net/manual/en/mongogridfs.delete.php
1747 * @param mixed $id _id of the file to remove
1748 * @return boolean Returns true if the remove was successfully sent to the database.
1749 */
1750 public function delete($id) {}
1751
1752 /**
1753 * Saves an uploaded file directly from a POST to the database
1754 * @link http://www.php.net/manual/en/mongogridfs.storeupload.php
1755 * @param string $name The name attribute of the uploaded file, from <input type="file" name="something"/>.
1756 * @param array $metadata An array of extra fields for the uploaded file.
1757 * @return mixed Returns the _id of the uploaded file.
1758 */
1759 public function storeUpload($name, array $metadata = array()) {}
1760
1761
1762 /**
1763 * Retrieve a file from the database
1764 * @link http://www.php.net/manual/en/mongogridfs.get.php
1765 * @param mixed $id _id of the file to find.
1766 * @return MongoGridFSFile|null Returns the file, if found, or NULL.
1767 */
1768 public function get($id) {}
1769
1770 /**
1771 * Stores a file in the database
1772 * @link https://php.net/manual/en/mongogridfs.put.php
1773 * @param string $filename The name of the file
1774 * @param array $extra Other metadata to add to the file saved
1775 * @return mixed Returns the _id of the saved object
1776 */
1777 public function put($filename, array $extra = array()) {}
1778
1779}
1780
1781class MongoGridFSFile {
1782 /**
1783 * @link https://php.net/manual/en/class.mongogridfsfile.php#mongogridfsfile.props.file
1784 * @var $file
1785 */
1786 public $file;
1787
1788 /**
1789 * @link https://php.net/manual/en/class.mongogridfsfile.php#mongogridfsfile.props.gridfs
1790 * @var $gridfs
1791 */
1792 protected $gridfs;
1793
1794 /**
1795 * @link https://php.net/manual/en/mongogridfsfile.construct.php
1796 * @param MongoGridFS $gridfs The parent MongoGridFS instance
1797 * @param array $file A file from the database
1798 */
1799 public function __construct($gridfs, array $file) {}
1800
1801 /**
1802 * Returns this file's filename
1803 * @link https://php.net/manual/en/mongogridfsfile.getfilename.php
1804 * @return string Returns the filename
1805 */
1806 public function getFilename() {}
1807
1808 /**
1809 * Returns this file's size
1810 * @link https://php.net/manual/en/mongogridfsfile.getsize.php
1811 * @return int Returns this file's size
1812 */
1813 public function getSize() {}
1814
1815 /**
1816 * Writes this file to the filesystem
1817 * @link https://php.net/manual/en/mongogridfsfile.write.php
1818 * @param string $filename The location to which to write the file (path+filename+extension). If none is given, the stored filename will be used.
1819 * @return int Returns the number of bytes written
1820 */
1821 public function write($filename = null) {}
1822
1823 /**
1824 * This will load the file into memory. If the file is bigger than your memory, this will cause problems!
1825 * @link https://php.net/manual/en/mongogridfsfile.getbytes.php
1826 * @return string Returns a string of the bytes in the file
1827 */
1828 public function getBytes() {}
1829
1830 /**
1831 * This method returns a stream resource that can be used to read the stored file with all file functions in PHP.
1832 * The contents of the file are pulled out of MongoDB on the fly, so that the whole file does not have to be loaded into memory first.
1833 * At most two GridFSFile chunks will be loaded in memory.
1834 *
1835 * @link https://php.net/manual/en/mongogridfsfile.getresource.php
1836 * @return resource Returns a resource that can be used to read the file with
1837 */
1838 public function getResource() {}
1839}
1840
1841class MongoGridFSCursor extends MongoCursor implements Traversable, Iterator {
1842 /**
1843 * @static
1844 * @var $slaveOkay
1845 */
1846 public static $slaveOkay;
1847
1848 /**
1849 * @link https://php.net/manual/en/class.mongogridfscursor.php#mongogridfscursor.props.gridfs
1850 * @var $gridfs
1851 */
1852 protected $gridfs;
1853
1854 /**
1855 * Create a new cursor
1856 * @link https://php.net/manual/en/mongogridfscursor.construct.php
1857 * @param MongoGridFS $gridfs Related GridFS collection
1858 * @param resource $connection Database connection
1859 * @param string $ns Full name of database and collection
1860 * @param array $query Database query
1861 * @param array $fields Fields to return
1862 */
1863 public function __construct($gridfs, $connection, $ns, $query, $fields) {}
1864
1865 /**
1866 * Return the next file to which this cursor points, and advance the cursor
1867 * @link https://php.net/manual/en/mongogridfscursor.getnext.php
1868 * @return MongoGridFSFile Returns the next file
1869 */
1870 public function getNext() {}
1871
1872 /**
1873 * Returns the current file
1874 * @link https://php.net/manual/en/mongogridfscursor.current.php
1875 * @return MongoGridFSFile The current file
1876 */
1877 public function current() {}
1878
1879 /**
1880 * Returns the current result's filename
1881 * @link https://php.net/manual/en/mongogridfscursor.key.php
1882 * @return string The current results filename
1883 */
1884 public function key() {}
1885
1886}
1887
1888/**
1889 * A unique identifier created for database objects.
1890 * @link http://www.php.net/manual/en/class.mongoid.php
1891 */
1892class MongoId {
1893 /**
1894 * @var string $id <p> Note: The property name begins with a $ character. It may be accessed using
1895 * {@link https://php.net/manual/en/language.types.string.php#language.types.string.parsing.complex complex variable parsed syntax} (e.g. $mongoId->{'$id'}).</p>
1896 */
1897 public $id = NULL;
1898
1899 /**
1900 * (PECL mongo >= 0.8.0)
1901 * Creates a new id
1902 * @link http://www.php.net/manual/en/mongoid.construct.php
1903 * @param string $id [optional] A string to use as the id. Must be 24 hexidecimal characters. If an invalid string is passed to this constructor, the constructor will ignore it and create a new id value.
1904 */
1905 public function __construct($id = NULL) {}
1906
1907 /**
1908 * (PECL mongo >= 0.8.0)
1909 * Check if a value is a valid ObjectId
1910 * @link https://php.net/manual/en/mongoid.isvalid.php
1911 * @param mixed $value The value to check for validity.
1912 * @return bool <p>
1913 * Returns <b>TRUE</b> if <i>value</i> is a
1914 * MongoId instance or a string consisting of exactly 24
1915 * hexadecimal characters; otherwise, <b>FALSE</b> is returned.
1916 * </p>
1917 */
1918 public static function isValid($value) {}
1919 /**
1920 * (PECL mongo >= 0.8.0)
1921 * Returns a hexidecimal representation of this id
1922 * @link http://www.php.net/manual/en/mongoid.tostring.php
1923 * @return string This id.
1924 */
1925 public function __toString() {}
1926
1927 /**
1928 * (PECL mongo >= 1.0.11)
1929 * Gets the incremented value to create this id
1930 * @link https://php.net/manual/en/mongoid.getinc.php
1931 * @return int Returns the incremented value used to create this MongoId.
1932 */
1933 public function getInc() {}
1934
1935 /**
1936 * (PECL mongo >= 1.0.11)
1937 * Gets the process ID
1938 * @link https://php.net/manual/en/mongoid.getpid.php
1939 * @return int Returns the PID of the MongoId.
1940 */
1941 public function getPID() {}
1942
1943 /**
1944 * (PECL mongo >= 1.0.1)
1945 * Gets the number of seconds since the epoch that this id was created
1946 * @link http://www.php.net/manual/en/mongoid.gettimestamp.php
1947 * @return int
1948 */
1949 public function getTimestamp() {}
1950
1951 /**
1952 * (PECL mongo >= 1.0.8)
1953 * Gets the hostname being used for this machine's ids
1954 * @link http://www.php.net/manual/en/mongoid.gethostname.php
1955 * @return string Returns the hostname.
1956 */
1957 public static function getHostname() {}
1958
1959 /**
1960 * (PECL mongo >= 1.0.8)
1961 * Create a dummy MongoId
1962 * @link https://php.net/manual/en/mongoid.set-state.php
1963 * @param array $props <p>Theoretically, an array of properties used to create the new id. However, as MongoId instances have no properties, this is not used.</p>
1964 * @return MongoId A new id with the value "000000000000000000000000".
1965 */
1966 public static function __set_state(array $props) {}
1967}
1968
1969class MongoCode {
1970 /**
1971 * @var $code
1972 */
1973 public $code;
1974
1975 /**
1976 * @var $scope
1977 */
1978 public $scope;
1979
1980 /**
1981 * .
1982 *
1983 * @link https://php.net/manual/en/mongocode.construct.php
1984 * @param string $code A string of code
1985 * @param array $scope The scope to use for the code
1986 */
1987 public function __construct($code, array $scope = array()) {}
1988
1989 /**
1990 * Returns this code as a string
1991 * @return string
1992 */
1993 public function __toString() {}
1994}
1995
1996class MongoRegex {
1997 /**
1998 * @link https://php.net/manual/en/class.mongoregex.php#mongoregex.props.regex
1999 * @var $regex
2000 */
2001 public $regex;
2002
2003 /**
2004 * @link https://php.net/manual/en/class.mongoregex.php#mongoregex.props.flags
2005 * @var $flags
2006 */
2007 public $flags;
2008
2009 /**
2010 * Creates a new regular expression.
2011 *
2012 * @link https://php.net/manual/en/mongoregex.construct.php
2013 * @param string $regex Regular expression string of the form /expr/flags
2014 */
2015 public function __construct($regex) {}
2016
2017 /**
2018 * Returns a string representation of this regular expression.
2019 * @return string This regular expression in the form "/expr/flags".
2020 */
2021 public function __toString() {}
2022}
2023
2024class MongoDate {
2025 /**
2026 * @link https://php.net/manual/en/class.mongodate.php#mongodate.props.sec
2027 * @var int $sec
2028 */
2029 public $sec;
2030
2031 /**
2032 * @link https://php.net/manual/en/class.mongodate.php#mongodate.props.usec
2033 * @var int $usec
2034 */
2035 public $usec;
2036
2037 /**
2038 * Creates a new date. If no parameters are given, the current time is used.
2039 *
2040 * @link https://php.net/manual/en/mongodate.construct.php
2041 * @param int $sec Number of seconds since January 1st, 1970
2042 * @param int $usec Microseconds
2043 */
2044 public function __construct($sec = 0, $usec = 0) {}
2045
2046 /**
2047 * Returns a DateTime object representing this date
2048 * @link https://php.net/manual/en/mongodate.todatetime.php
2049 * @return DateTime
2050 */
2051 public function toDateTime() {}
2052
2053 /**
2054 * Returns a string representation of this date
2055 * @return string
2056 */
2057 public function __toString() {}
2058}
2059
2060class MongoBinData {
2061 /**
2062 * Generic binary data.
2063 * @link https://php.net/manual/en/class.mongobindata.php#mongobindata.constants.custom
2064 */
2065 const GENERIC = 0x0;
2066
2067 /**
2068 * Function
2069 * @link https://php.net/manual/en/class.mongobindata.php#mongobindata.constants.func
2070 */
2071 const FUNC = 0x1;
2072
2073 /**
2074 * Generic binary data (deprecated in favor of MongoBinData::GENERIC)
2075 * @link https://php.net/manual/en/class.mongobindata.php#mongobindata.constants.byte-array
2076 */
2077 const BYTE_ARRAY = 0x2;
2078
2079 /**
2080 * Universally unique identifier (deprecated in favor of MongoBinData::UUID_RFC4122)
2081 * @link https://php.net/manual/en/class.mongobindata.php#mongobindata.constants.uuid
2082 */
2083 const UUID = 0x3;
2084
2085 /**
2086 * Universally unique identifier (according to » RFC 4122)
2087 * @link https://php.net/manual/en/class.mongobindata.php#mongobindata.constants.custom
2088 */
2089 const UUID_RFC4122 = 0x4;
2090
2091
2092 /**
2093 * MD5
2094 * @link https://php.net/manual/en/class.mongobindata.php#mongobindata.constants.md5
2095 */
2096 const MD5 = 0x5;
2097
2098 /**
2099 * User-defined type
2100 * @link https://php.net/manual/en/class.mongobindata.php#mongobindata.constants.custom
2101 */
2102 const CUSTOM = 0x80;
2103
2104
2105 /**
2106 * @link https://php.net/manual/en/class.mongobindata.php#mongobindata.props.bin
2107 * @var $bin
2108 */
2109 public $bin;
2110
2111 /**
2112 * @link https://php.net/manual/en/class.mongobindata.php#mongobindata.props.type
2113 * @var $type
2114 */
2115 public $type;
2116
2117
2118 /**
2119 * Creates a new binary data object.
2120 *
2121 * @link https://php.net/manual/en/mongobindata.construct.php
2122 * @param string $data Binary data
2123 * @param int $type Data type
2124 */
2125 public function __construct($data, $type = 2) {}
2126
2127 /**
2128 * Returns the string representation of this binary data object.
2129 * @return string
2130 */
2131 public function __toString() {}
2132}
2133
2134class MongoDBRef {
2135 /**
2136 * @static
2137 * @var $refKey
2138 */
2139 protected static $refKey = '$ref';
2140
2141 /**
2142 * @static
2143 * @var $idKey
2144 */
2145 protected static $idKey = '$id';
2146
2147 /**
2148 * If no database is given, the current database is used.
2149 *
2150 * @link https://php.net/manual/en/mongodbref.create.php
2151 * @static
2152 * @param string $collection Collection name (without the database name)
2153 * @param mixed $id The _id field of the object to which to link
2154 * @param string $database Database name
2155 * @return array Returns the reference
2156 */
2157 public static function create($collection, $id, $database = null) {}
2158
2159 /**
2160 * This not actually follow the reference, so it does not determine if it is broken or not.
2161 * It merely checks that $ref is in valid database reference format (in that it is an object or array with $ref and $id fields).
2162 *
2163 * @link https://php.net/manual/en/mongodbref.isref.php
2164 * @static
2165 * @param mixed $ref Array or object to check
2166 * @return boolean Returns true if $ref is a reference
2167 */
2168 public static function isRef($ref) {}
2169
2170 /**
2171 * Fetches the object pointed to by a reference
2172 * @link https://php.net/manual/en/mongodbref.get.php
2173 * @static
2174 * @param MongoDB $db Database to use
2175 * @param array $ref Reference to fetch
2176 * @return array|null Returns the document to which the reference refers or null if the document does not exist (the reference is broken)
2177 */
2178 public static function get($db, $ref) {}
2179}
2180
2181class MongoWriteBatch
2182{
2183
2184 const COMMAND_INSERT = 1;
2185 const COMMAND_UPDATE = 2;
2186 const COMMAND_DELETE = 3;
2187
2188
2189 /**
2190 * <p>(PECL mongo >= 1.5.0)</p>
2191 * MongoWriteBatch constructor.
2192 * @link https://php.net/manual/en/mongowritebatch.construct.php
2193 * @param MongoCollection $collection The {@see MongoCollection} to execute the batch on.
2194 * Its {@link https://php.net/manual/en/mongo.writeconcerns.php write concern}
2195 * will be copied and used as the default write concern if none is given as <code >$write_options</code> or during
2196 * {@see MongoWriteBatch::execute()}.
2197 * @param string $batch_type [optional] <p>
2198 * One of:
2199 * </p><ul>
2200 * <li class="member"><em>0</em> - make an MongoWriteBatch::COMMAND_INSERT batch</li>
2201 * <li class="member"><em>1</em> - make an MongoWriteBatch::COMMAND_UPDATE batch</li>
2202 * <li class="member"><em>2</em> - make a MongoWriteBatch::COMMAND_DELETE batch</li>
2203 * </ul>
2204 * @param array $write_options [optional]
2205 * <p> An array of Write Options.</p><table><thead><tr><th>key</th><th>value meaning</th></tr>
2206 * </thead>
2207 * <tbody><tr><td>w (int|string)</td><td>{@link https://php.net/manual/en/mongo.writeconcerns.php Write concern} value</td></tr>
2208 * <tr><td>wtimeout (int)</td><td>{@link https://php.net/manual/en/mongo.writeconcerns.php Maximum time to wait for replication}</td></tr>
2209 * <tr><td>ordered</td><td>Determins if MongoDB must apply this batch in order (sequentally, one item at a time) or can rearrange it.
2210 * Defaults to <strong><code>TRUE</code></strong></td></tr>
2211 * <tr><td>j (bool)</td><td>Wait for journaling on the primary. This value is discouraged, use WriteConcern instead</td></tr>
2212 * <tr><td>fsync (bool)</td><td>Wait for fsync on the primary. This value is discouraged, use WriteConcern instead</td></tr>
2213 * </tbody></table>
2214 */
2215 protected function __construct($collection, $batch_type, $write_options)
2216 {
2217 }
2218
2219 /**
2220 * <p>(PECL mongo >= 1.5.0)</p>
2221 * Adds a write operation to a batch
2222 * @link https://php.net/manual/en/mongowritebatch.add.php
2223 * @param array $item <p>
2224 * An array that describes a write operation. The structure of this value
2225 * depends on the batch's operation type.
2226 * </p><table>
2227 * <thead>
2228 * <tr>
2229 * <th>Batch type</th>
2230 * <th>Argument expectation</th>
2231 * </tr>
2232 *
2233 * </thead>
2234 *
2235 * <tbody>
2236 * <tr>
2237 * <td><strong><code>MongoWriteBatch::COMMAND_INSERT</code></strong></td>
2238 * <td>
2239 * The document to add.
2240 * </td>
2241 * </tr>
2242 * <tr>
2243 * <td><strong><code>MongoWriteBatch::COMMAND_UPDATE</code></strong></td>
2244 * <td>
2245 * <p>Raw update operation.</p>
2246 * <p>Required keys are <em>"q"</em> and <em>"u"</em>, which correspond to the
2247 * <code>$criteria</code> and <code$new_object</code> parameters of {@see MongoCollection::update()}, respectively.</p>
2248 * <p>Optional keys are <em>"multi"</em> and <em>"upsert"</em>, which correspond to the
2249 * <em>"multiple"</em> and <em>"upsert"</em> options for {@see MongoCollection::update()}, respectively.
2250 * If unspecified, both options default to <strong><code>FALSE</code></strong>.</p>
2251 * </td>
2252 * </tr>
2253 * <tr>
2254 * <td><strong><code>MongoWriteBatch::COMMAND_DELETE</code></strong></td>
2255 * <td>
2256 * <p class="para">Raw delete operation.</p>
2257 * <p>Required keys are: <em>"q"</em> and <em>"limit"</em>, which correspond to the <code>$criteria</code> parameter
2258 * and <em>"justOne"</em> option of {@see MongoCollection::remove()}, respectively.</p>
2259 * <p>The <em>"limit"</em> option is an integer; however, MongoDB only supports <em>0</em> (i.e. remove all matching
2260 * ocuments) and <em>1</em> (i.e. remove at most one matching document) at this time.</p>
2261 * </td>
2262 * </tr>
2263 * </tbody>
2264 * </table>
2265 * @return bool <b>Returns TRUE on success and throws an exception on failure.</b>
2266 */
2267 public function add(array $item)
2268 {
2269 }
2270
2271 /**
2272 * <p>(PECL mongo >= 1.5.0)</p>
2273 * Executes a batch of write operations
2274 * @link https://php.net/manual/en/mongowritebatch.execute.php
2275 * @param array $write_options See {@see MongoWriteBatch::__construct}
2276 * @return array Returns an array containing statistical information for the full batch.
2277 * If the batch had to be split into multiple batches, the return value will aggregate the values from individual batches and return only the totals.
2278 * If the batch was empty, an array containing only the 'ok' field is returned (as <b>TRUE</b<) although nothing will be shipped over the wire (NOOP).
2279 */
2280 final public function execute(array $write_options)
2281 {
2282 }
2283}
2284
2285class MongoUpdateBatch extends MongoWriteBatch
2286{
2287
2288 /**
2289 * <p>(PECL mongo >= 1.5.0)</p>
2290 * MongoUpdateBatch constructor.
2291 * @link https://php.net/manual/en/mongoupdatebatch.construct.php
2292 * @param MongoCollection $collection <p>The MongoCollection to execute the batch on.
2293 * Its write concern will be copied and used as the default write concern
2294 * if none is given as $write_options or during {@see MongoWriteBatch::execute()}.</p>
2295 * @param array $write_options <p class="para">An array of Write Options.</p><table class="doctable informaltable"><thead><tr><th>key</th><th>value meaning</th></tr>
2296 * </thead>
2297 * <tbody class="tbody"><tr><td>w (int|string)</td><td>{@link https://php.net/manual/en/mongo.writeconcerns.php Write concern} value</td></tr>
2298 * <tr><td>wtimeout (int)</td><td>{@link https://php.net/manual/en/mongo.writeconcerns.php Maximum time to wait for replication}</td></tr>
2299 * <tr><td>ordered</td><td>Determins if MongoDB must apply this batch in order (sequentally, one item at a time) or can rearrange it. Defaults to <strong><code>TRUE</code></strong></td></tr>
2300 * <tr><td>j (bool)</td><td>Wait for journaling on the primary. This value is discouraged, use WriteConcern instead</td></tr>
2301 * <tr><td>fsync (bool)</td><td>Wait for fsync on the primary. This value is discouraged, use WriteConcern instead</td></tr>
2302 * </tbody></table>
2303 */
2304 public function __construct(MongoCollection $collection, array $write_options)
2305 {
2306 }
2307
2308
2309}
2310
2311class MongoException extends Exception {
2312}
2313
2314class MongoCursorException extends MongoException {
2315
2316}
2317
2318class MongoCursorTimeoutException extends MongoCursorException {
2319
2320}
2321
2322class MongoConnectionException extends MongoException {
2323
2324}
2325
2326class MongoGridFSException extends MongoException {
2327
2328}
2329
2330/**
2331 * <p>(PECL mongo >= 1.5.0)</p>
2332 * @link https://php.net/manual/en/class.mongowriteconcernexception.php#class.mongowriteconcernexception
2333 */
2334class MongoWriteConcernException extends MongoCursorException {
2335 /**
2336 * Get the error document
2337 * @link https://php.net/manual/en/mongowriteconcernexception.getdocument.php
2338 * @return array <p>A MongoDB document, if available, as an array.</p>
2339 */
2340 public function getDocument() {}
2341}
2342
2343/**
2344 * <p>(PECL mongo >= 1.5.0)</p>
2345 * @link https://php.net/manual/en/class.mongoexecutiontimeoutexception.php
2346 */
2347class MongoExecutionTimeoutException extends MongoException {}
2348
2349/**
2350 * <p>(PECL mongo >= 1.5.0)</p>
2351 */
2352class MongoProtocolException extends MongoException {}
2353
2354/**
2355 * <p>(PECL mongo >= 1.5.0)</p>
2356 * @link https://php.net/manual/en/class.mongoduplicatekeyexception.php
2357 */
2358class MongoDuplicateKeyException extends MongoWriteConcernException {
2359
2360}
2361
2362/**
2363 * <p>(PECL mongo >= 1.3.0)</p>
2364 * @link https://php.net/manual/en/class.mongoresultexception.php#mongoresultexception.props.document
2365 *
2366 */
2367class MongoResultException extends MongoException {
2368 /**
2369 * <p>(PECL mongo >= 1.3.0)</p>
2370 * Retrieve the full result document
2371 * http://php.net/manual/en/mongoresultexception.getdocument.php
2372 * @return array <p>The full result document as an array, including partial data if available and additional keys.</p>
2373 */
2374 public function getDocument () {}
2375
2376 public $document;
2377
2378
2379}
2380
2381class MongoTimestamp {
2382 /**
2383 * @link https://php.net/manual/en/class.mongotimestamp.php#mongotimestamp.props.sec
2384 * @var $sec
2385 */
2386 public $sec;
2387
2388 /**
2389 * @link https://php.net/manual/en/class.mongotimestamp.php#mongotimestamp.props.inc
2390 * @var $inc
2391 */
2392 public $inc;
2393
2394 /**
2395 * Creates a new timestamp. If no parameters are given, the current time is used
2396 * and the increment is automatically provided. The increment is set to 0 when the
2397 * module is loaded and is incremented every time this constructor is called
2398 * (without the $inc parameter passed in).
2399 *
2400 * @link https://php.net/manual/en/mongotimestamp.construct.php
2401 * @param int $sec [optional] Number of seconds since January 1st, 1970
2402 * @param int $inc [optional] Increment
2403 */
2404 public function __construct($sec = 0, $inc) {}
2405
2406 /**
2407 * @return string
2408 */
2409 public function __toString() {}
2410}
2411
2412class MongoInt32 {
2413 /**
2414 * @link https://php.net/manual/en/class.mongoint32.php#mongoint32.props.value
2415 * @var $value
2416 */
2417 public $value;
2418
2419
2420 /**
2421 * Creates a new 32-bit number with the given value.
2422 *
2423 * @link https://php.net/manual/en/mongoint32.construct.php
2424 * @param string $value A number
2425 */
2426 public function __construct($value) {}
2427
2428 /**
2429 * @return string
2430 */
2431 public function __toString() {}
2432}
2433
2434class MongoInt64 {
2435 /**
2436 * @link https://php.net/manual/en/class.mongoint64.php#mongoint64.props.value
2437 * @var $value
2438 */
2439 public $value;
2440
2441
2442 /**
2443 * Creates a new 64-bit number with the given value.
2444 *
2445 * @link https://php.net/manual/en/mongoint64.construct.php
2446 * @param string $value A number
2447 */
2448 public function __construct($value) {}
2449
2450 /**
2451 * @return string
2452 */
2453 public function __toString() {}
2454}
2455
2456class MongoLog {
2457 /**
2458 * @link https://php.net/manual/en/class.mongolog.php#mongolog.constants.none
2459 */
2460 const NONE = 0;
2461
2462 /**
2463 * @link https://php.net/manual/en/class.mongolog.php#mongolog.constants.all
2464 */
2465 const ALL = 0;
2466
2467 /**
2468 * @link https://php.net/manual/en/class.mongolog.php#mongolog.constants.warning
2469 */
2470 const WARNING = 0;
2471
2472 /**
2473 * @link https://php.net/manual/en/class.mongolog.php#mongolog.constants.info
2474 */
2475 const INFO = 0;
2476
2477 /**
2478 * @link https://php.net/manual/en/class.mongolog.php#mongolog.constants.fine
2479 */
2480 const FINE = 0;
2481
2482 /**
2483 * @link https://php.net/manual/en/class.mongolog.php#mongolog.constants.rs
2484 */
2485 const RS = 0;
2486
2487 /**
2488 * @link https://php.net/manual/en/class.mongolog.php#mongolog.constants.pool
2489 */
2490 const POOL = 0;
2491
2492 /**
2493 * @link https://php.net/manual/en/class.mongolog.php#mongolog.constants.io
2494 */
2495 const IO = 0;
2496
2497 /**
2498 * @link https://php.net/manual/en/class.mongolog.php#mongolog.constants.server
2499 */
2500 const SERVER = 0;
2501
2502 /**
2503 * @link https://php.net/manual/en/class.mongolog.php#mongolog.constants.parse
2504 */
2505 const PARSE = 0;
2506
2507 const CON = 2;
2508
2509 /**
2510 * (PECL mongo >= 1.3.0)<br/>
2511 * <p>
2512 * This function will set a callback function to be called for {@link http://www.php.net/manual/en/class.mongolog.php MongoLog} events
2513 * instead of triggering warnings.
2514 * </p>
2515 * @link http://www.php.net/manual/en/mongolog.setcallback.php
2516 * @param callable $log_function <p>
2517 * The function to be called on events.
2518 * </p>
2519 * <p>
2520 * The function should have the following prototype
2521 * </p>
2522 *
2523 * <em>log_function</em> ( <em>int</em> <em>$module</em> , <em>int</em> <em>$level</em>, <em>string</em> <em>$message</em>)
2524 * <ul>
2525 * <li>
2526 * <b><i>module</i></b>
2527 *
2528 * <p>One of the {@link http://www.php.net/manual/en/class.mongolog.php#mongolog.constants.module MongoLog module constants}.</p>
2529 * </li>
2530 * <li>
2531 * <b><i>level</i></b>
2532 *
2533 * <p>One of the {@link http://www.php.net/manual/en/class.mongolog.php#mongolog.constants.level MongoLog level constants}.</p>
2534 * </li
2535 * <li>
2536 * <b><i>message</i></b>
2537 *
2538 * <p>The log message itself.</p></li>
2539 * <ul>
2540 * @return boolean Returns <b>TRUE</b> on success or <b>FALSE</b> on failure.
2541 */
2542 public static function setCallback ( callable $log_function ) {}
2543
2544 /**
2545 * This function can be used to set how verbose logging should be and the types of
2546 * activities that should be logged. Use the constants described in the MongoLog
2547 * section with bitwise operators to specify levels.
2548 *
2549 * @link https://php.net/manual/en/mongolog.setlevel.php
2550 * @static
2551 * @param int $level The levels you would like to log
2552 * @return void
2553 */
2554 public static function setLevel($level) {}
2555
2556 /**
2557 * This can be used to see the log level. Use the constants described in the
2558 * MongoLog section with bitwise operators to check the level.
2559 *
2560 * @link https://php.net/manual/en/mongolog.getlevel.php
2561 * @static
2562 * @return int Returns the current level
2563 */
2564 public static function getLevel() {}
2565
2566 /**
2567 * This function can be used to set which parts of the driver's functionality
2568 * should be logged. Use the constants described in the MongoLog section with
2569 * bitwise operators to specify modules.
2570 *
2571 * @link https://php.net/manual/en/mongolog.setmodule.php
2572 * @static
2573 * @param int $module The module(s) you would like to log
2574 * @return void
2575 */
2576 public static function setModule($module) {}
2577
2578 /**
2579 * This function can be used to see which parts of the driver's functionality are
2580 * being logged. Use the constants described in the MongoLog section with bitwise
2581 * operators to check if specific modules are being logged.
2582 *
2583 * @link https://php.net/manual/en/mongolog.getmodule.php
2584 * @static
2585 * @return int Returns the modules currently being logged
2586 */
2587 public static function getModule() {}
2588}
2589
2590class MongoPool {
2591 /**
2592 * Returns an array of information about all connection pools.
2593 *
2594 * @link https://php.net/manual/en/mongopool.info.php
2595 * @static
2596 * @return array Each connection pool has an identifier, which starts with the host. For
2597 * each pool, this function shows the following fields: $in use The number of
2598 * connections currently being used by Mongo instances. $in pool The number of
2599 * connections currently in the pool (not being used). $remaining The number of
2600 * connections that could be created by this pool. For example, suppose a pool had
2601 * 5 connections remaining and 3 connections in the pool. We could create 8 new
2602 * instances of Mongo before we exhausted this pool (assuming no instances of Mongo
2603 * went out of scope, returning their connections to the pool). A negative number
2604 * means that this pool will spawn unlimited connections. Before a pool is created,
2605 * you can change the max number of connections by calling Mongo::setPoolSize. Once
2606 * a pool is showing up in the output of this function, its size cannot be changed.
2607 * $total The total number of connections allowed for this pool. This should be
2608 * greater than or equal to "in use" + "in pool" (or -1). $timeout The socket
2609 * timeout for connections in this pool. This is how long connections in this pool
2610 * will attempt to connect to a server before giving up. $waiting If you have
2611 * capped the pool size, workers requesting connections from the pool may block
2612 * until other workers return their connections. This field shows how many
2613 * milliseconds workers have blocked for connections to be released. If this number
2614 * keeps increasing, you may want to use MongoPool::setSize to add more connections
2615 * to your pool
2616 */
2617 public static function info() {}
2618
2619 /**
2620 * Sets the max number of connections new pools will be able to create.
2621 *
2622 * @link https://php.net/manual/en/mongopool.setsize.php
2623 * @static
2624 * @param int $size The max number of connections future pools will be able to
2625 * create. Negative numbers mean that the pool will spawn an infinite number of
2626 * connections
2627 * @return boolean Returns the former value of pool size
2628 */
2629 public static function setSize($size) {}
2630
2631 /**
2632 * .
2633 *
2634 * @link https://php.net/manual/en/mongopool.getsize.php
2635 * @static
2636 * @return int Returns the current pool size
2637 */
2638 public static function getSize() {}
2639}
2640
2641
2642class MongoMaxKey {
2643}
2644
2645class MongoMinKey {
2646}