forked from HvyIndustries/crane-php-stubs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
mongo.php
6250 lines (5723 loc) · 220 KB
/
mongo.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
// Start of mongo v.1.6.11
/**
* A connection manager for PHP and MongoDB.
* @link http://php.net/manual/en/class.mongoclient.php
*/
class MongoClient {
const DEFAULT_HOST = "localhost";
const DEFAULT_PORT = 27017;
const VERSION = "1.6.11";
const RP_PRIMARY = "primary";
const RP_PRIMARY_PREFERRED = "primaryPreferred";
const RP_SECONDARY = "secondary";
const RP_SECONDARY_PREFERRED = "secondaryPreferred";
const RP_NEAREST = "nearest";
/**
* @var boolean
*/
public $connected;
/**
* @var string
*/
public $status;
/**
* @var string
*/
protected $server;
/**
* @var boolean
*/
protected $persistent;
/**
* (PECL mongo >=1.3.0)<br/>
* Creates a new database connection object
* @link http://php.net/manual/en/mongoclient.construct.php
* @param string $server [optional]
* @param array $options [optional]
* @param array $driver_options [optional]
*/
public function __construct ($server = "mongodb://localhost:27017", array $options = 'array("connect" => true)', array $driver_options = null) {}
/**
* (PECL mongo >=1.3.0)<br/>
* Return info about all open connections
* @link http://php.net/manual/en/mongoclient.getconnections.php
* @return array An array of open connections.
*/
public static function getConnections () {}
/**
* (PECL mongo >=1.3.0)<br/>
* Connects to a database server
* @link http://php.net/manual/en/mongoclient.connect.php
* @return bool If the connection was successful.
*/
public function connect () {}
/**
* (PECL mongo >=1.3.0)<br/>
* String representation of this connection
* @link http://php.net/manual/en/mongoclient.tostring.php
* @return string hostname and port for this connection.
*/
public function __toString () {}
/**
* (PECL mongo >=1.3.0)<br/>
* Gets a database
* @link http://php.net/manual/en/mongoclient.get.php
* @param string $dbname <p>
* The database name.
* </p>
* @return MongoDB a new db object.
*/
public function __get ($dbname) {}
/**
* (PECL mongo >=1.3.0)<br/>
* Gets a database
* @link http://php.net/manual/en/mongoclient.selectdb.php
* @param string $name <p>
* The database name.
* </p>
* @return MongoDB a new database object.
*/
public function selectDB ($name) {}
/**
* (PECL mongo >=1.3.0)<br/>
* Gets a database collection
* @link http://php.net/manual/en/mongoclient.selectcollection.php
* @param string $db <p>
* The database name.
* </p>
* @param string $collection <p>
* The collection name.
* </p>
* @return MongoCollection a new collection object.
*/
public function selectCollection ($db, $collection) {}
/**
* (PECL mongo >=1.3.0)<br/>
* Get the read preference for this connection
* @link http://php.net/manual/en/mongoclient.getreadpreference.php
* @return array
*/
public function getReadPreference () {}
/**
* (PECL mongo >=1.3.0)<br/>
* Set the read preference for this connection
* @link http://php.net/manual/en/mongoclient.setreadpreference.php
* @param string $read_preference
* @param array $tags [optional]
* @return bool
*/
public function setReadPreference ($read_preference, array $tags = null) {}
/**
* (PECL mongo >=1.5.0)<br/>
* Get the write concern for this connection
* @link http://php.net/manual/en/mongoclient.getwriteconcern.php
* @return array
*/
public function getWriteConcern () {}
/**
* (PECL mongo >=1.5.0)<br/>
* Set the write concern for this connection
* @link http://php.net/manual/en/mongoclient.setwriteconcern.php
* @param mixed $w
* @param int $wtimeout [optional]
* @return bool
*/
public function setWriteConcern ($w, $wtimeout = null) {}
/**
* (PECL mongo >=1.3.0)<br/>
* Drops a database [deprecated]
* @link http://php.net/manual/en/mongoclient.dropdb.php
* @param mixed $db <p>
* The database to drop. Can be a MongoDB object or the name of the database.
* </p>
* @return array the database response.
*/
public function dropDB ($db) {}
/**
* (PECL mongo >=1.3.0)<br/>
* Lists all of the databases available.
* @link http://php.net/manual/en/mongoclient.listdbs.php
* @return array 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 th
* 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.
*/
public function listDBs () {}
/**
* (PECL mongo >=1.3.0)<br/>
* Updates status for all associated hosts
* @link http://php.net/manual/en/mongoclient.gethosts.php
* @return array an array of information about the hosts in the set. Includes each
* host's hostname, its health (1 is healthy), its state (1 is primary, 2 is
* secondary, 0 is anything else), the amount of time it took to ping the
* server, and when the last ping occurred. For example, on a three-member
* replica set, it might look something like:
*/
public function getHosts () {}
/**
* (PECL mongo >=1.3.0)<br/>
* Closes this connection
* @link http://php.net/manual/en/mongoclient.close.php
* @param boolean|string $connection [optional] <p>
* 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.
* </p>
* <p>
* 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.
* </p>
* <p>
* 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
* <b>MongoClient::getConnections</b>.
* </p>
* @return bool if the connection was successfully closed.
*/
public function close ($connection = null) {}
/**
* (PECL mongo >=1.5.0)<br/>
* Kills a specific cursor on the server
* @link http://php.net/manual/en/mongoclient.killcursor.php
* @param string $server_hash <p>
* The server hash that has the cursor. This can be obtained through
* <b>MongoCursor::info</b>.
* </p>
* @param int|MongoInt64 $id <p>
* The ID of the cursor to kill. You can either supply an int
* containing the 64 bit cursor ID, or an object of the
* <b>MongoInt64</b> class. The latter is necessary on 32
* bit platforms (and Windows).
* </p>
* @return bool <b>TRUE</b> if the method attempted to kill a cursor, and <b>FALSE</b> if
* there was something wrong with the arguments (such as a wrong
* <i>server_hash</i>). The return status does not
* reflect where the cursor was actually killed as the server does
* not provide that information.
*/
public static function killCursor ($server_hash, $id) {}
}
/**
* A connection between PHP and MongoDB.
* @link http://php.net/manual/en/class.mongo.php
*/
class Mongo extends MongoClient {
const DEFAULT_HOST = "localhost";
const DEFAULT_PORT = 27017;
const VERSION = "1.6.11";
const RP_PRIMARY = "primary";
const RP_PRIMARY_PREFERRED = "primaryPreferred";
const RP_SECONDARY = "secondary";
const RP_SECONDARY_PREFERRED = "secondaryPreferred";
const RP_NEAREST = "nearest";
/**
* @var boolean
*/
public $connected;
/**
* @var string
*/
public $status;
/**
* @var string
*/
protected $server;
/**
* @var boolean
*/
protected $persistent;
/**
* (PECL mongo >=0.9.0)<br/>
* The __construct purpose
* @link http://php.net/manual/en/mongo.construct.php
* @param string $server [optional]
* @param array $options [optional]
*/
public function __construct ($server = null, array $options = null) {}
/**
* (PECL mongo >=0.9.0)<br/>
* Connects with a database server
* @link http://php.net/manual/en/mongo.connectutil.php
* @return bool If the connection was successful.
*/
protected function connectUtil () {}
/**
* (PECL mongo >=1.1.0)<br/>
* Get slaveOkay setting for this connection
* @link http://php.net/manual/en/mongo.getslaveokay.php
* @return bool the value of slaveOkay for this instance.
*/
public function getSlaveOkay () {}
/**
* (PECL mongo >=1.1.0)<br/>
* Change slaveOkay setting for this connection
* @link http://php.net/manual/en/mongo.setslaveokay.php
* @param bool $ok [optional] <p>
* If reads should be sent to secondary members of a replica set for all
* possible queries using this <b>MongoClient</b> instance.
* </p>
* @return bool the former value of slaveOkay for this instance.
*/
public function setSlaveOkay ($ok = true) {}
public function lastError () {}
public function prevError () {}
public function resetError () {}
public function forceError () {}
/**
* (PECL mongo >=1.1.0)<br/>
* Returns the address being used by this for slaveOkay reads
* @link http://php.net/manual/en/mongo.getslave.php
* @return string The address of the secondary this connection is using for reads.
* </p>
* <p>
* This returns <b>NULL</b> if this is not connected to a replica set or not yet
* initialized.
*/
public function getSlave () {}
/**
* (PECL mongo >=1.1.0)<br/>
* Choose a new secondary for slaveOkay reads
* @link http://php.net/manual/en/mongo.switchslave.php
* @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.
* </p>
* <p>
* 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.
*/
public function switchSlave () {}
/**
* (PECL mongo >=1.2.0)<br/>
* Set the size for future connection pools.
* @link http://php.net/manual/en/mongo.setpoolsize.php
* @param int $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>
* @return bool the former value of pool size.
*/
public static function setPoolSize ($size) {}
/**
* (PECL mongo >=1.2.0)<br/>
* Get pool size for connection pools
* @link http://php.net/manual/en/mongo.getpoolsize.php
* @return int the current pool size.
*/
public static function getPoolSize () {}
/**
* (PECL mongo >=1.2.0)<br/>
* Returns information about all connection pools.
* @link http://php.net/manual/en/mongo.pooldebug.php
* @return array Each connection pool has an identifier, which starts with the host. For each
* pool, this function shows the following fields:
* <i>in use</i>
* <p>
* The number of connections currently being used by
* <b>MongoClient</b> instances.
* </p>
* <i>in pool</i>
* <p>
* The number of connections currently in the pool (not being used).
* </p>
* <i>remaining</i>
* <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
* <b>MongoClient</b> before we exhausted this pool
* (assuming no instances of <b>MongoClient</b> went out of
* scope, returning their connections to the pool).
* </p>
* <p>
* A negative number means that this pool will spawn unlimited connections.
* </p>
* <p>
* Before a pool is created, you can change the max number of connections by
* calling <b>Mongo::setPoolSize</b>. Once a pool is showing
* up in the output of this function, its size cannot be changed.
* </p>
* <i>timeout</i>
* <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>
*/
public static function poolDebug () {}
/**
* (PECL mongo >=1.3.0)<br/>
* Return info about all open connections
* @link http://php.net/manual/en/mongoclient.getconnections.php
* @return array An array of open connections.
*/
public static function getConnections () {}
/**
* (PECL mongo >=1.3.0)<br/>
* Connects to a database server
* @link http://php.net/manual/en/mongoclient.connect.php
* @return bool If the connection was successful.
*/
public function connect () {}
/**
* (PECL mongo >=1.3.0)<br/>
* String representation of this connection
* @link http://php.net/manual/en/mongoclient.tostring.php
* @return string hostname and port for this connection.
*/
public function __toString () {}
/**
* (PECL mongo >=1.3.0)<br/>
* Gets a database
* @link http://php.net/manual/en/mongoclient.get.php
* @param string $dbname <p>
* The database name.
* </p>
* @return MongoDB a new db object.
*/
public function __get ($dbname) {}
/**
* (PECL mongo >=1.3.0)<br/>
* Gets a database
* @link http://php.net/manual/en/mongoclient.selectdb.php
* @param string $name <p>
* The database name.
* </p>
* @return MongoDB a new database object.
*/
public function selectDB ($name) {}
/**
* (PECL mongo >=1.3.0)<br/>
* Gets a database collection
* @link http://php.net/manual/en/mongoclient.selectcollection.php
* @param string $db <p>
* The database name.
* </p>
* @param string $collection <p>
* The collection name.
* </p>
* @return MongoCollection a new collection object.
*/
public function selectCollection ($db, $collection) {}
/**
* (PECL mongo >=1.3.0)<br/>
* Get the read preference for this connection
* @link http://php.net/manual/en/mongoclient.getreadpreference.php
* @return array
*/
public function getReadPreference () {}
/**
* (PECL mongo >=1.3.0)<br/>
* Set the read preference for this connection
* @link http://php.net/manual/en/mongoclient.setreadpreference.php
* @param string $read_preference
* @param array $tags [optional]
* @return bool
*/
public function setReadPreference ($read_preference, array $tags = null) {}
/**
* (PECL mongo >=1.5.0)<br/>
* Get the write concern for this connection
* @link http://php.net/manual/en/mongoclient.getwriteconcern.php
* @return array
*/
public function getWriteConcern () {}
/**
* (PECL mongo >=1.5.0)<br/>
* Set the write concern for this connection
* @link http://php.net/manual/en/mongoclient.setwriteconcern.php
* @param mixed $w
* @param int $wtimeout [optional]
* @return bool
*/
public function setWriteConcern ($w, $wtimeout = null) {}
/**
* (PECL mongo >=1.3.0)<br/>
* Drops a database [deprecated]
* @link http://php.net/manual/en/mongoclient.dropdb.php
* @param mixed $db <p>
* The database to drop. Can be a MongoDB object or the name of the database.
* </p>
* @return array the database response.
*/
public function dropDB ($db) {}
/**
* (PECL mongo >=1.3.0)<br/>
* Lists all of the databases available.
* @link http://php.net/manual/en/mongoclient.listdbs.php
* @return array 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 th
* 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.
*/
public function listDBs () {}
/**
* (PECL mongo >=1.3.0)<br/>
* Updates status for all associated hosts
* @link http://php.net/manual/en/mongoclient.gethosts.php
* @return array an array of information about the hosts in the set. Includes each
* host's hostname, its health (1 is healthy), its state (1 is primary, 2 is
* secondary, 0 is anything else), the amount of time it took to ping the
* server, and when the last ping occurred. For example, on a three-member
* replica set, it might look something like:
*/
public function getHosts () {}
/**
* (PECL mongo >=1.3.0)<br/>
* Closes this connection
* @link http://php.net/manual/en/mongoclient.close.php
* @param boolean|string $connection [optional] <p>
* 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.
* </p>
* <p>
* 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.
* </p>
* <p>
* 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
* <b>MongoClient::getConnections</b>.
* </p>
* @return bool if the connection was successfully closed.
*/
public function close ($connection = null) {}
/**
* (PECL mongo >=1.5.0)<br/>
* Kills a specific cursor on the server
* @link http://php.net/manual/en/mongoclient.killcursor.php
* @param string $server_hash <p>
* The server hash that has the cursor. This can be obtained through
* <b>MongoCursor::info</b>.
* </p>
* @param int|MongoInt64 $id <p>
* The ID of the cursor to kill. You can either supply an int
* containing the 64 bit cursor ID, or an object of the
* <b>MongoInt64</b> class. The latter is necessary on 32
* bit platforms (and Windows).
* </p>
* @return bool <b>TRUE</b> if the method attempted to kill a cursor, and <b>FALSE</b> if
* there was something wrong with the arguments (such as a wrong
* <i>server_hash</i>). The return status does not
* reflect where the cursor was actually killed as the server does
* not provide that information.
*/
public static function killCursor ($server_hash, $id) {}
}
/**
* Instances of this class are used to interact with a database. To get a
* database:
* Selecting a database
* <code>
* $m = new MongoClient(); // connect
* $db = $m->selectDB("example");
* </code>
* Database names can use almost any character in the ASCII range. However,
* they cannot contain " ", "." or be the empty string.
* The name "system" is also reserved.
* @link http://php.net/manual/en/class.mongodb.php
*/
class MongoDB {
const PROFILING_OFF = 0;
const PROFILING_SLOW = 1;
const PROFILING_ON = 2;
/**
* @var integer
*/
public $w;
/**
* @var integer
*/
public $wtimeout;
/**
* (PECL mongo >=0.9.0)<br/>
* Creates a new database
* @link http://php.net/manual/en/mongodb.construct.php
* @param MongoClient $conn <p>
* Database connection.
* </p>
* @param string $name <p>
* Database name.
* </p>
*/
public function __construct (MongoClient $conn, $name) {}
/**
* (PECL mongo >=0.9.0)<br/>
* The name of this database
* @link http://php.net/manual/en/mongodb.--tostring.php
* @return string this database's name.
*/
public function __toString () {}
/**
* (PECL mongo >=1.0.2)<br/>
* Gets a collection
* @link http://php.net/manual/en/mongodb.get.php
* @param string $name <p>
* The name of the collection.
* </p>
* @return MongoCollection the collection.
*/
public function __get ($name) {}
/**
* (PECL mongo >=0.9.0)<br/>
* Fetches toolkit for dealing with files stored in this database
* @link http://php.net/manual/en/mongodb.getgridfs.php
* @param string $prefix [optional] <p>
* The prefix for the files and chunks collections.
* </p>
* @return MongoGridFS a new gridfs object for this database.
*/
public function getGridFS ($prefix = 'fs') {}
/**
* (PECL mongo >=1.1.0)<br/>
* Get slaveOkay setting for this database
* @link http://php.net/manual/en/mongodb.getslaveokay.php
* @return bool the value of slaveOkay for this instance.
*/
public function getSlaveOkay () {}
/**
* (PECL mongo >=1.1.0)<br/>
* Change slaveOkay setting for this database
* @link http://php.net/manual/en/mongodb.setslaveokay.php
* @param bool $ok [optional] <p>
* If reads should be sent to secondary members of a replica set for all
* possible queries using this <b>MongoDB</b> instance.
* </p>
* @return bool the former value of slaveOkay for this instance.
*/
public function setSlaveOkay ($ok = true) {}
/**
* (PECL mongo >=1.3.0)<br/>
* Get the read preference for this database
* @link http://php.net/manual/en/mongodb.getreadpreference.php
* @return array
*/
public function getReadPreference () {}
/**
* (PECL mongo >=1.3.0)<br/>
* Set the read preference for this database
* @link http://php.net/manual/en/mongodb.setreadpreference.php
* @param string $read_preference
* @param array $tags [optional]
* @return bool
*/
public function setReadPreference ($read_preference, array $tags = null) {}
/**
* (PECL mongo >=1.5.0)<br/>
* Get the write concern for this database
* @link http://php.net/manual/en/mongodb.getwriteconcern.php
* @return array
*/
public function getWriteConcern () {}
/**
* (PECL mongo >=1.5.0)<br/>
* Set the write concern for this database
* @link http://php.net/manual/en/mongodb.setwriteconcern.php
* @param mixed $w
* @param int $wtimeout [optional]
* @return bool
*/
public function setWriteConcern ($w, $wtimeout = null) {}
/**
* (PECL mongo >=0.9.0)<br/>
* Gets this database's profiling level
* @link http://php.net/manual/en/mongodb.getprofilinglevel.php
* @return int the profiling level.
*/
public function getProfilingLevel () {}
/**
* (PECL mongo >=0.9.0)<br/>
* Sets this database's profiling level
* @link http://php.net/manual/en/mongodb.setprofilinglevel.php
* @param int $level <p>
* Profiling level.
* </p>
* @return int the previous profiling level.
*/
public function setProfilingLevel ($level) {}
/**
* (PECL mongo >=0.9.0)<br/>
* Drops this database
* @link http://php.net/manual/en/mongodb.drop.php
* @return array the database response.
*/
public function drop () {}
/**
* (PECL mongo >=0.9.0)<br/>
* Repairs and compacts this database
* @link http://php.net/manual/en/mongodb.repair.php
* @param bool $preserve_cloned_files [optional] <p>
* If cloned files should be kept if the repair fails.
* </p>
* @param bool $backup_original_files [optional] <p>
* If original files should be backed up.
* </p>
* @return array db response.
*/
public function repair ($preserve_cloned_files = false, $backup_original_files = false) {}
/**
* (PECL mongo >=0.9.0)<br/>
* Gets a collection
* @link http://php.net/manual/en/mongodb.selectcollection.php
* @param string $name <p>
* The collection name.
* </p>
* @return MongoCollection a new collection object.
*/
public function selectCollection ($name) {}
/**
* (PECL mongo >=0.9.0)<br/>
* Creates a collection
* @link http://php.net/manual/en/mongodb.createcollection.php
* @param string $name <p>
* The name of the collection.
* </p>
* @param array $options [optional] <p>
* An array containing options for the collections. Each option is its own
* element in the options array, with the option name listed below being
* the key of the element. The supported options depend on the MongoDB
* server version and storage engine, and the driver passes any option
* that you give it straight to the server. A few of the supported options
* are, but you can find a full list in the MongoDB core docs on createCollection:
* </p>
* <p>
* <i>capped</i>
* <p>
* If the collection should be a fixed size.
* </p>
* @return MongoCollection a collection object representing the new collection.
*/
public function createCollection ($name, array $options = null) {}
/**
* (PECL mongo >=0.9.0)<br/>
* Drops a collection [deprecated]
* @link http://php.net/manual/en/mongodb.dropcollection.php
* @param mixed $coll <p>
* MongoCollection or name of collection to drop.
* </p>
* @return array the database response.
*/
public function dropCollection ($coll) {}
/**
* (PECL mongo >=0.9.0)<br/>
* Gets an array of MongoCollection objects for all collections in this database
* @link http://php.net/manual/en/mongodb.listcollections.php
* @param array $options [optional] <p>
* An array of options for listing the collections. Currently available
* options include:
* <p>"filter"</p><p>Optional query criteria. If provided, this criteria will be used to filter the collections included in the result.</p><p>Relevant fields that may be queried include "name" (collection name as a string, without the database name prefix) and "options" (object containing options used to create the collection)..</p>MongoDB 2.6 and earlier versions require the "name" criteria, if specified, to be a string value (i.e. equality match). This is because the driver must prefix the value with the database name in order to query the system.namespaces collection. Later versions of MongoDB do not have this limitation, as the driver will use the listCollections command.
* <p>"includeSystemCollections"</p><p>Boolean, defaults to <b>FALSE</b>. Determines whether system collections should be included in the result.</p>
* </p>
* <p>
* The following option may be used with MongoDB 2.8+:
* <p>"maxTimeMS"</p><p>Specifies a cumulative time limit in milliseconds for processing the operation (does not include idle time). If the operation is not completed within the timeout period, a <b>MongoExecutionTimeoutException</b> will be thrown.</p>
* </p>
* @return array an array of MongoCollection objects.
*/
public function listCollections (array $options = 'array()') {}
/**
* (PECL mongo >=1.3.0)<br/>
* Gets an array of names for all collections in this database
* @link http://php.net/manual/en/mongodb.getcollectionnames.php
* @param array $options [optional] <p>
* An array of options for listing the collections. Currently available
* options include:
* <p>"filter"</p><p>Optional query criteria. If provided, this criteria will be used to filter the collections included in the result.</p><p>Relevant fields that may be queried include "name" (collection name as a string, without the database name prefix) and "options" (object containing options used to create the collection)..</p>MongoDB 2.6 and earlier versions require the "name" criteria, if specified, to be a string value (i.e. equality match). This is because the driver must prefix the value with the database name in order to query the system.namespaces collection. Later versions of MongoDB do not have this limitation, as the driver will use the listCollections command.
* <p>"includeSystemCollections"</p><p>Boolean, defaults to <b>FALSE</b>. Determines whether system collections should be included in the result.</p>
* </p>
* <p>
* The following option may be used with MongoDB 2.8+:
* <p>"maxTimeMS"</p><p>Specifies a cumulative time limit in milliseconds for processing the operation (does not include idle time). If the operation is not completed within the timeout period, a <b>MongoExecutionTimeoutException</b> will be thrown.</p>
* </p>
* @return array the collection names as an array of strings.
*/
public function getCollectionNames (array $options = 'array()') {}
/**
* (PECL mongo >=1.6.0)<br/>
* Returns information about collections in this database
* @link http://php.net/manual/en/mongodb.getcollectioninfo.php
* @param array $options [optional] <p>
* An array of options for listing the collections. Currently available
* options include:
* <p>"filter"</p><p>Optional query criteria. If provided, this criteria will be used to filter the collections included in the result.</p><p>Relevant fields that may be queried include "name" (collection name as a string, without the database name prefix) and "options" (object containing options used to create the collection)..</p>MongoDB 2.6 and earlier versions require the "name" criteria, if specified, to be a string value (i.e. equality match). This is because the driver must prefix the value with the database name in order to query the system.namespaces collection. Later versions of MongoDB do not have this limitation, as the driver will use the listCollections command.
* <p>"includeSystemCollections"</p><p>Boolean, defaults to <b>FALSE</b>. Determines whether system collections should be included in the result.</p>
* </p>
* <p>
* The following option may be used with MongoDB 2.8+:
* <p>"maxTimeMS"</p><p>Specifies a cumulative time limit in milliseconds for processing the operation (does not include idle time). If the operation is not completed within the timeout period, a <b>MongoExecutionTimeoutException</b> will be thrown.</p>
* </p>
* @return array This function returns an array where each element is an array describing a
* collection. Elements will contain a name key denoting the
* name of the collection, and optionally contain an options
* key denoting an array of objects used to create the collection. For example,
* capped collections will include capped and
* size options.
*/
public function getCollectionInfo (array $options = 'array()') {}
/**
* (PECL mongo >=0.9.0)<br/>
* Creates a database reference
* @link http://php.net/manual/en/mongodb.createdbref.php
* @param string $collection <p>
* The collection to which the database reference will point.
* </p>
* @param mixed $document_or_id <p>
* If an array or object is given, its _id field will be
* used as the reference ID. If a <b>MongoId</b> or scalar
* is given, it will be used as the reference ID.
* </p>
* @return array a database reference array.
* </p>
* <p>
* If an array without an _id field was provided as the
* document_or_id parameter, <b>NULL</b> will be returned.
*/
public function createDBRef ($collection, $document_or_id) {}
/**
* (PECL mongo >=0.9.0)<br/>
* Fetches the document pointed to by a database reference
* @link http://php.net/manual/en/mongodb.getdbref.php
* @param array $ref <p>
* A database reference.
* </p>
* @return array the document pointed to by the reference.
*/
public function getDBRef (array $ref) {}
/**
* (PECL mongo >=0.9.3)<br/>
* Runs JavaScript code on the database server.
* @link http://php.net/manual/en/mongodb.execute.php
* @param mixed $code <p>
* <b>MongoCode</b> or string to execute.
* </p>
* @param array $args [optional] <p>
* Arguments to be passed to code.
* </p>
* @return array the result of the evaluation.
*/
public function execute ($code, array $args = 'array()') {}
/**
* (PECL mongo >=0.9.2)<br/>
* Execute a database command
* @link http://php.net/manual/en/mongodb.command.php
* @param array $command <p>
* The query to send.
* </p>
* @param array $options [optional] <p>
* An array of options for the index creation. Currently available options
* include:
* <p>"socketTimeoutMS"</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 -1 may be specified to block indefinitely. The default value for <b>MongoClient</b> is 30000 (30 seconds).</p>
* </p>
* <p>
* The following options are deprecated and should no longer be used:
* <p>"timeout"</p><p>Deprecated alias for "socketTimeoutMS".</p>
* </p>
* @param string $hash [optional] <p>
* Set to the connection hash of the server that executed the command. When
* the command result is suitable for creating a
* <b>MongoCommandCursor</b>, the hash is intended to be
* passed to <b>MongoCommandCursor::createFromDocument</b>.
* </p>
* <p>
* The hash will also correspond to a connection returned from
* <b>MongoClient::getConnections</b>.
* </p>
* @return array database response. Every database response is always maximum one
* document, which means that the result of a database command can never
* exceed 16MB. The resulting document's structure depends on the command, but
* most results will have the ok field to indicate success
* or failure and results containing an array of each of
* the resulting documents.
*/
public function command (array $command, array $options = 'array()', &$hash = null) {}
/**
* (PECL mongo >=0.9.5)<br/>
* Check if there was an error on the most recent db operation performed
* @link http://php.net/manual/en/mongodb.lasterror.php
* @return array the error, if there was one.
*/
public function lastError () {}
/**
* (PECL mongo >=0.9.5)<br/>
* Checks for the last error thrown during a database operation
* @link http://php.net/manual/en/mongodb.preverror.php
* @return array the error and the number of operations ago it occurred.
*/
public function prevError () {}
/**
* (PECL mongo >=0.9.5)<br/>
* Clears any flagged errors on the database
* @link http://php.net/manual/en/mongodb.reseterror.php
* @return array the database response.
*/
public function resetError () {}
/**
* (PECL mongo >=0.9.5)<br/>
* Creates a database error
* @link http://php.net/manual/en/mongodb.forceerror.php
* @return bool the database response.
*/
public function forceError () {}
/**
* (PECL mongo >=1.0.1)<br/>
* Log in to this database
* @link http://php.net/manual/en/mongodb.authenticate.php
* @param string $username <p>
* The username.
* </p>
* @param string $password <p>
* The password (in plaintext).
* </p>
* @return array database response. If the login was successful, it will return
* <code>
* array("ok" => 1);
* </code>
* If something went wrong, it will return
* <code>
* array("ok" => 0, "errmsg" => "auth fails");
* </code>
* ("auth fails" could be another message, depending on database version and what
* when wrong).
*/
public function authenticate ($username, $password) {}
}
/**
* Represents a MongoDB collection.
* @link http://php.net/manual/en/class.mongocollection.php
*/
class MongoCollection {
const ASCENDING = 1;
const DESCENDING = -1;
/**