Completed
Push — master ( 2b5327...235414 )
by Peter
09:57
created

AvailableCommands::planCacheListQueryShapes()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 0
cp 0
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
/**
4
 * This software package is licensed under New BSD license.
5
 *
6
 * @package maslosoft/mangan
7
 * @licence New BSD
8
 * @copyright Copyright (c) Piotr Masełkowski <[email protected]>
9
 * @copyright Copyright (c) Maslosoft
10
 * @copyright Copyright (c) Others as mentioned in code
11
 * @link http://maslosoft.com/mangan/
12
 */
13
14
namespace Maslosoft\Mangan\Traits;
15
16
/**
17
 * AvailableCommands
18
 *
19
 * @author Piotr Maselkowski <pmaselkowski at gmail.com>
20
 */
21
trait AvailableCommands
22
{
23
	abstract public function call($command, $arguments = []);
24
	
25
	/**
26
	 * { _isSelf : 1 } INTERNAL ONLY
27
	 */
28
	public function _isSelf()
29
	{
30
		return $this->call('_isSelf', func_get_args());
31
	}
32
33
	/**
34
	 * { pipeline: [ { $operator: {...}}, ... ], explain: <bool>, allowDiskUse: <bool>, cursor: {batchSize: <number>} }
35
	 * See http://dochub.mongodb.org/core/aggregation for more details.
36
	 */
37
	public function aggregate()
38
	{
39
		return $this->call('aggregate', func_get_args());
40
	}
41
42
	/**
43
	 * internal (sharding)
44
	 * { applyOps : [ ] , preCondition : [ { ns : ... , q : ... , res : ... } ] }
45
	 */
46
	public function applyOps()
47
	{
48
		return $this->call('applyOps', func_get_args());
49
	}
50
51
	/**
52
	 * internal
53
	 */
54
	public function authenticate()
55
	{
56
		return $this->call('authenticate', func_get_args());
57
	}
58
59
	/**
60
	 * no help defined
61
	 */
62
	public function availableQueryOptions()
63
	{
64
		return $this->call('availableQueryOptions', func_get_args());
65
	}
66
67
	/**
68
	 * get version #, etc.
69
	 * { buildinfo:1 }
70
	 */
71
	public function buildInfo()
72
	{
73
		return $this->call('buildInfo', func_get_args());
74
	}
75
76
	/**
77
	 * Internal command.
78
	 * 
79
	 */
80
	public function checkShardingIndex()
81
	{
82 2
		return $this->call('checkShardingIndex', func_get_args());
83
	}
84 2
85
	/**
86
	 * clone this database from an instance of the db on another host
87
	 * {clone: "host13"[, slaveOk: <bool>]}
88
	 */
89
	public function cloneDb()
90
	{
91
		return $this->call('clone', func_get_args());
92
	}
93
94
	/**
95
	 * { cloneCollection: <collection>, from: <host> [,query: <query_filter>] [,copyIndexes:<bool>] }
96
	 * Copies a collection from one server to another. Do not use on a single server as the destination is placed at the same db.collection (namespace) as the source.
97
	 * 
98
	 */
99
	public function cloneCollection()
100
	{
101
		return $this->call('cloneCollection', func_get_args());
102
	}
103
104
	/**
105
	 * { cloneCollectionAsCapped:<fromName>, toCollection:<toName>, size:<sizeInBytes> }
106
	 */
107
	public function cloneCollectionAsCapped()
108
	{
109
		return $this->call('cloneCollectionAsCapped', func_get_args());
110
	}
111
112
	/**
113
	 * Sets collection options.
114
	 * Example: { collMod: 'foo', usePowerOf2Sizes:true }
115
	 * Example: { collMod: 'foo', index: {keyPattern: {a: 1}, expireAfterSeconds: 600} Example: { collMod: 'foo', index: {name: 'bar', expireAfterSeconds: 600} }
116
	 * 
117
	 */
118
	public function collMod()
119
	{
120
		return $this->call('collMod', func_get_args());
121
	}
122
123
	/**
124
	 * { collStats:"blog.posts" , scale : 1 } scale divides sizes e.g. for KB use 1024
125
	 *     avgObjSize - in bytes
126
	 */
127
	public function collStats()
128
	{
129
		return $this->call('collStats', func_get_args());
130
	}
131
132
	/**
133
	 * compact collection
134
	 * warning: this operation locks the database and is slow. you can cancel with killOp()
135
	 * { compact : <collection_name>, [force:<bool>], [validate:<bool>],
136
	 *   [paddingFactor:<num>], [paddingBytes:<num>] }
137
	 *   force - allows to run on a replica set primary
138
	 *   validate - check records are noncorrupt before adding to newly compacting extents. slower but safer (defaults to true in this version)
139
	 * 
140
	 */
141
	public function compact()
142
	{
143
		return $this->call('compact', func_get_args());
144
	}
145
146
	/**
147
	 * stats about connections between servers in a replica set or sharded cluster.
148
	 */
149
	public function connPoolStats()
150
	{
151
		return $this->call('connPoolStats', func_get_args());
152
	}
153
154
	/**
155
	 * internal
156
	 */
157
	public function connPoolSync()
158
	{
159
		return $this->call('connPoolSync', func_get_args());
160
	}
161
162
	/**
163
	 * Returns connection-specific information such as logged-in users and their roles
164
	 */
165
	public function connectionStatus()
166
	{
167
		return $this->call('connectionStatus', func_get_args());
168
	}
169
170
	/**
171
	 * { convertToCapped:<fromCollectionName>, size:<sizeInBytes> }
172
	 */
173
	public function convertToCapped()
174
	{
175
		return $this->call('convertToCapped', func_get_args());
176
	}
177
178
	/**
179
	 * count objects in collection
180
	 */
181
	public function count()
182
	{
183
		return $this->call('count', func_get_args());
184
	}
185
186
	/**
187
	 * create a collection explicitly
188
	 * { create: <ns>[, capped: <bool>, size: <collSizeInBytes>, max: <nDocs>] }
189
	 */
190
	public function create()
191
	{
192
		return $this->call('create', func_get_args());
193
	}
194
195
	/**
196
	 * no help defined
197
	 */
198
	public function createIndexes()
199
	{
200
		return $this->call('createIndexes', func_get_args());
201
	}
202
203
	/**
204
	 * Adds a role to the system
205
	 * 
206
	 */
207
	public function createRole()
208
	{
209
		return $this->call('createRole', func_get_args());
210
	}
211
212
	/**
213
	 * Adds a user to the system
214
	 * 
215
	 */
216
	public function createUser()
217
	{
218
		return $this->call('createUser', func_get_args());
219
	}
220
221
	/**
222
	 * no help defined
223
	 */
224
	public function currentOpCtx()
225
	{
226
		return $this->call('currentOpCtx', func_get_args());
227
	}
228
229
	/**
230
	 * determine data size for a set of data in a certain range
231
	 * example: { dataSize:"blog.posts", keyPattern:{x:1}, min:{x:10}, max:{x:55} }
232
	 * min and max parameters are optional. They must either both be included or both omitted
233
	 * keyPattern is an optional parameter indicating an index pattern that would be usefulfor iterating over the min/max bounds. If keyPattern is omitted, it is inferred from the structure of min. 
234
	 * note: This command may take a while to run
235
	 */
236
	public function dataSize()
237
	{
238
		return $this->call('dataSize', func_get_args());
239
	}
240
241
	/**
242
	 * no help defined
243
	 */
244
	public function dbHash()
245
	{
246
		return $this->call('dbHash', func_get_args());
247
	}
248
249
	/**
250
	 * Get stats on a database. Not instantaneous. Slower for databases with large .ns files.
251
	 * Example: { dbStats:1, scale:1 }
252
	 */
253
	public function dbStats()
254
	{
255
		return $this->call('dbStats', func_get_args());
256
	}
257
258
	/**
259
	 * delete documents
260
	 */
261
	public function delete()
262
	{
263
		return $this->call('delete', func_get_args());
264
	}
265
266
	/**
267
	 * { distinct : 'collection name' , key : 'a.b' , query : {} }
268
	 */
269
	public function distinct()
270
	{
271
		return $this->call('distinct', func_get_args());
272
	}
273
274
	/**
275
	 * no help defined
276
	 */
277
	public function driverOIDTest()
278
	{
279
		return $this->call('driverOIDTest', func_get_args());
280
	}
281
282
	/**
283
	 * drop a collection
284
	 * {drop : <collectionName>}
285
	 */
286
	public function drop()
287
	{
288
		return $this->call('drop', func_get_args());
289
	}
290
291
	/**
292
	 * Drops all roles from the given database.  Before deleting the roles completely it must remove them from any users or other roles that reference them.  If any errors occur in the middle of that process it's possible to be left in a state where the roles have been removed from some user/roles but otherwise still exist.
293
	 * 
294
	 */
295
	public function dropAllRolesFromDatabase()
296
	{
297
		return $this->call('dropAllRolesFromDatabase', func_get_args());
298
	}
299
300
	/**
301
	 * Drops all users for a single database.
302
	 * 
303
	 */
304
	public function dropAllUsersFromDatabase()
305
	{
306
		return $this->call('dropAllUsersFromDatabase', func_get_args());
307
	}
308
309
	/**
310
	 * drop (delete) this database
311
	 */
312
	public function dropDatabase()
313
	{
314
		return $this->call('dropDatabase', func_get_args());
315
	}
316
317
	/**
318
	 * drop indexes for a collection
319
	 */
320
	public function dropIndexes()
321
	{
322
		return $this->call('dropIndexes', func_get_args());
323
	}
324
325
	/**
326
	 * Drops a single role.  Before deleting the role completely it must remove it from any users or roles that reference it.  If any errors occur in the middle of that process it's possible to be left in a state where the role has been removed from some user/roles but otherwise still exists.
327
	 * 
328
	 */
329
	public function dropRole()
330
	{
331
		return $this->call('dropRole', func_get_args());
332
	}
333
334
	/**
335
	 * Drops a single user.
336
	 * 
337
	 */
338
	public function dropUser()
339
	{
340
		return $this->call('dropUser', func_get_args());
341
	}
342
343
	/**
344
	 * DEPRECATED
345
	 * Evaluate javascript at the server.
346
	 * http://dochub.mongodb.org/core/serversidecodeexecution
347
	 */
348
	public function evalJs()
349
	{
350
		return $this->call('eval', func_get_args());
351
	}
352
353
	/**
354
	 * explain database reads and writes
355
	 */
356
	public function explain()
357
	{
358
		return $this->call('explain', func_get_args());
359
	}
360
361
	/**
362
	 * return build level feature settings
363
	 */
364
	public function features()
365
	{
366
		return $this->call('features', func_get_args());
367
	}
368
369
	/**
370
	 *  example: { filemd5 : ObjectId(aaaaaaa) , root : "fs" }
371
	 */
372
	public function filemd5()
373
	{
374
		return $this->call('filemd5', func_get_args());
375
	}
376
377
	/**
378
	 * query for documents
379
	 */
380
	public function find()
381
	{
382
		return $this->call('find', func_get_args());
383
	}
384
385
	/**
386
	 * { findAndModify: "collection", query: {processed:false}, update: {$set: {processed:true}}, new: true}
387
	 * { findAndModify: "collection", query: {processed:false}, remove: true, sort: {priority:-1}}
388
	 * Either update or remove is required, all other fields have default values.
389
	 * Output is in the "value" field
390
	 * 
391
	 */
392
	public function findAndModify()
393
	{
394
		return $this->call('findAndModify', func_get_args());
395
	}
396
397
	/**
398
	 * for testing purposes only.  forces a user assertion exception
399
	 */
400
	public function forceerror()
401
	{
402
		return $this->call('forceerror', func_get_args());
403
	}
404
405
	/**
406
	 * http://dochub.mongodb.org/core/geo#GeospatialIndexing-geoNearCommand
407
	 */
408
	public function geoNear()
409
	{
410
		return $this->call('geoNear', func_get_args());
411
	}
412
413
	/**
414
	 * no help defined
415
	 */
416
	public function geoSearch()
417
	{
418
		return $this->call('geoSearch', func_get_args());
419
	}
420
421
	/**
422
	 * return error status of the last operation on this connection
423
	 * options:
424
	 *   { fsync:true } - fsync before returning, or wait for journal commit if running with --journal
425
	 *   { j:true } - wait for journal commit if running with --journal
426
	 *   { w:n } - await replication to n servers (including self) before returning
427
	 *   { w:'majority' } - await replication to majority of set
428
	 *   { wtimeout:m} - timeout for w in m milliseconds
429
	 */
430
	public function getLastError()
431
	{
432
		return $this->call('getLastError', func_get_args());
433
	}
434
435
	/**
436
	 * retrieve more results from an existing cursor
437
	 */
438
	public function getMore()
439
	{
440
		return $this->call('getMore', func_get_args());
441
	}
442
443
	/**
444
	 * check for errors since last reseterror commandcal
445
	 */
446
	public function getPrevError()
447
	{
448
		return $this->call('getPrevError', func_get_args());
449
	}
450
451
	/**
452
	 * internal
453
	 */
454
	public function getnonce()
455
	{
456
		return $this->call('getnonce', func_get_args());
457
	}
458
459
	/**
460
	 * Grants privileges to a role
461
	 * 
462
	 */
463
	public function grantPrivilegesToRole()
464
	{
465
		return $this->call('grantPrivilegesToRole', func_get_args());
466
	}
467
468
	/**
469
	 * Grants roles to another role.
470
	 * 
471
	 */
472
	public function grantRolesToRole()
473
	{
474
		return $this->call('grantRolesToRole', func_get_args());
475
	}
476
477
	/**
478
	 * Grants roles to a user.
479
	 * 
480
	 */
481
	public function grantRolesToUser()
482
	{
483
		return $this->call('grantRolesToUser', func_get_args());
484
	}
485
486
	/**
487
	 * http://dochub.mongodb.org/core/aggregation
488
	 */
489
	public function group()
490
	{
491
		return $this->call('group', func_get_args());
492
	}
493
494
	/**
495
	 * internal
496
	 */
497
	public function handshake()
498
	{
499
		return $this->call('handshake', func_get_args());
500
	}
501
502
	/**
503
	 * returns information about the daemon's host
504
	 */
505
	public function hostInfo()
506
	{
507
		return $this->call('hostInfo', func_get_args());
508
	}
509
510
	/**
511
	 * insert documents
512
	 */
513
	public function insert()
514
	{
515
		return $this->call('insert', func_get_args());
516
	}
517
518
	/**
519
	 * Check if this server is primary for a replica pair/set; also if it is --master or --slave in simple master/slave setups.
520
	 * { isMaster : 1 }
521
	 */
522
	public function isMaster()
523
	{
524
		return $this->call('isMaster', func_get_args());
525
	}
526
527
	/**
528
	 * kill a list of cursor ids
529
	 */
530
	public function killCursors()
531
	{
532
		return $this->call('killCursors', func_get_args());
533
	}
534
535
	/**
536
	 * list collections for this db
537
	 */
538
	public function listCollections()
539
	{
540
		return $this->call('listCollections', func_get_args());
541
	}
542
543
	/**
544
	 * get a list of all db commands
545
	 */
546
	public function listCommands()
547
	{
548
		return $this->call('listCommands', func_get_args());
549
	}
550
551
	/**
552
	 * list indexes for a collection
553
	 */
554
	public function listIndexes()
555
	{
556
		return $this->call('listIndexes', func_get_args());
557
	}
558
559
	/**
560
	 * de-authenticate
561
	 */
562
	public function logout()
563
	{
564
		return $this->call('logout', func_get_args());
565
	}
566
567
	/**
568
	 * Run a map/reduce operation on the server.
569
	 * Note this is used for aggregation, not querying, in MongoDB.
570
	 * http://dochub.mongodb.org/core/mapreduce
571
	 */
572
	public function mapReduce()
573
	{
574
		return $this->call('mapReduce', func_get_args());
575
	}
576
577
	/**
578
	 * internal
579
	 */
580
	public function mapReduceShardedFinish()
581
	{
582
		return $this->call('mapreduce.shardedfinish', func_get_args());
583
	}
584
585
	/**
586
	 * no help defined
587
	 */
588
	public function parallelCollectionScan()
589
	{
590
		return $this->call('parallelCollectionScan', func_get_args());
591
	}
592
593
	/**
594
	 * a way to check that the server is alive. responds immediately even if server is in a db lock.
595
	 */
596
	public function ping()
597
	{
598
		return $this->call('ping', func_get_args());
599
	}
600
601
	/**
602
	 * Drops one or all cached queries in a collection.
603
	 */
604
	public function planCacheClear()
605
	{
606
		return $this->call('planCacheClear', func_get_args());
607
	}
608
609
	/**
610
	 * Clears index filter for a single query shape or, if the query shape is omitted, all filters for the collection.
611
	 */
612
	public function planCacheClearFilters()
613
	{
614
		return $this->call('planCacheClearFilters', func_get_args());
615
	}
616
617
	/**
618
	 * Displays index filters for all query shapes in a collection.
619
	 */
620
	public function planCacheListFilters()
621
	{
622
		return $this->call('planCacheListFilters', func_get_args());
623
	}
624
625
	/**
626
	 * Displays the cached plans for a query shape.
627
	 */
628
	public function planCacheListPlans()
629
	{
630
		return $this->call('planCacheListPlans', func_get_args());
631
	}
632
633
	/**
634
	 * Displays all query shapes in a collection.
635
	 */
636
	public function planCacheListQueryShapes()
637
	{
638
		return $this->call('planCacheListQueryShapes', func_get_args());
639
	}
640
641
	/**
642
	 * Sets index filter for a query shape. Overrides existing filter.
643
	 */
644
	public function planCacheSetFilter()
645
	{
646
		return $this->call('planCacheSetFilter', func_get_args());
647
	}
648
649
	/**
650
	 * enable or disable performance profiling
651
	 * { profile : <n> }
652
	 * 0=off 1=log slow ops 2=log all
653
	 * -1 to get current values
654
	 * http://docs.mongodb.org/manual/reference/command/profile/#dbcmd.profile
655
	 */
656
	public function profile()
657
	{
658
		return $this->call('profile', func_get_args());
659
	}
660
661
	/**
662
	 * re-index a collection
663
	 */
664
	public function reIndex()
665
	{
666
		return $this->call('reIndex', func_get_args());
667
	}
668
669
	/**
670
	 * no help defined
671
	 */
672
	public function repairCursor()
673
	{
674
		return $this->call('repairCursor', func_get_args());
675
	}
676
677
	/**
678
	 * repair database.  also compacts. note: slow.
679
	 */
680
	public function repairDatabase()
681
	{
682
		return $this->call('repairDatabase', func_get_args());
683
	}
684
685
	/**
686
	 * reset error state (used with getpreverror)
687
	 */
688
	public function resetError()
689
	{
690
		return $this->call('resetError', func_get_args());
691
	}
692
693
	/**
694
	 * Revokes privileges from a role
695
	 * 
696
	 */
697
	public function revokePrivilegesFromRole()
698
	{
699
		return $this->call('revokePrivilegesFromRole', func_get_args());
700
	}
701
702
	/**
703
	 * Revokes roles from another role.
704
	 * 
705
	 */
706
	public function revokeRolesFromRole()
707
	{
708
		return $this->call('revokeRolesFromRole', func_get_args());
709
	}
710
711
	/**
712
	 * Revokes roles from a user.
713
	 * 
714
	 */
715
	public function revokeRolesFromUser()
716
	{
717
		return $this->call('revokeRolesFromUser', func_get_args());
718
	}
719
720
	/**
721
	 * Returns information about roles.
722
	 * 
723
	 */
724
	public function rolesInfo()
725
	{
726
		return $this->call('rolesInfo', func_get_args());
727
	}
728
729
	/**
730
	 * Subsequent steps in a SASL authentication conversation.
731
	 */
732
	public function saslContinue()
733
	{
734
		return $this->call('saslContinue', func_get_args());
735
	}
736
737
	/**
738
	 * First step in a SASL authentication conversation.
739
	 */
740
	public function saslStart()
741
	{
742
		return $this->call('saslStart', func_get_args());
743
	}
744
745
	/**
746
	 * returns lots of administrative server statistics
747
	 */
748
	public function serverStatus()
749
	{
750
		return $this->call('serverStatus', func_get_args());
751
	}
752
753
	/**
754
	 * stats about the shard connection pool
755
	 */
756
	public function shardConnPoolStats()
757
	{
758
		return $this->call('shardConnPoolStats', func_get_args());
759
	}
760
761
	/**
762
	 * Internal command.
763
	 * examples:
764
	 *   { splitVector : "blog.post" , keyPattern:{x:1} , min:{x:10} , max:{x:20}, maxChunkSize:200 }
765
	 *   maxChunkSize unit in MBs
766
	 *   May optionally specify 'maxSplitPoints' and 'maxChunkObjects' to avoid traversing the whole chunk
767
	 *   
768
	 *   { splitVector : "blog.post" , keyPattern:{x:1} , min:{x:10} , max:{x:20}, force: true }
769
	 *   'force' will produce one split point even if data is small; defaults to false
770
	 * NOTE: This command may take a while to run
771
	 */
772
	public function splitVector()
773
	{
774
		return $this->call('splitVector', func_get_args());
775
	}
776
777
	/**
778
	 * touch collection
779
	 * Page in all pages of memory containing every extent for the given collection
780
	 * { touch : <collection_name>, [data : true] , [index : true] }
781
	 *  at least one of data or index must be true; default is both are false
782
	 * 
783
	 */
784
	public function touch()
785
	{
786
		return $this->call('touch', func_get_args());
787
	}
788
789
	/**
790
	 * update documents
791
	 */
792
	public function update()
793
	{
794
		return $this->call('update', func_get_args());
795
	}
796
797
	/**
798
	 * Used to update a role
799
	 * 
800
	 */
801
	public function updateRole()
802
	{
803
		return $this->call('updateRole', func_get_args());
804
	}
805
806
	/**
807
	 * Used to update a user, for example to change its password
808
	 * 
809
	 */
810
	public function updateUser()
811
	{
812
		return $this->call('updateUser', func_get_args());
813
	}
814
815
	/**
816
	 * Returns information about users.
817
	 * 
818
	 */
819
	public function usersInfo()
820
	{
821
		return $this->call('usersInfo', func_get_args());
822
	}
823
824
	/**
825
	 * Validate contents of a namespace by scanning its data structures for correctness.  Slow.
826
	 * Add full:true option to do a more thorough check
827
	 */
828
	public function validate()
829
	{
830
		return $this->call('validate', func_get_args());
831
	}
832
833
	/**
834
	 * {whatsmyuri:1}
835
	 */
836
	public function whatsmyuri()
837
	{
838
		return $this->call('whatsmyuri', func_get_args());
839
	}
840
841
}
842