1 | <?php |
||
9 | class Collection |
||
10 | { |
||
11 | use \PHPDaemon\Traits\ClassWatchdog; |
||
12 | use \PHPDaemon\Traits\StaticObjectWatchdog; |
||
13 | |||
14 | /** |
||
15 | * @var Pool Related Pool object |
||
16 | */ |
||
17 | public $pool; |
||
18 | |||
19 | /** |
||
20 | * @var string Name of collection |
||
21 | */ |
||
22 | public $name; |
||
23 | |||
24 | /** |
||
25 | * Contructor of MongoClientAsyncCollection |
||
26 | * @param string $name Name of collection |
||
27 | * @param Pool $pool Pool |
||
28 | * @return void |
||
|
|||
29 | */ |
||
30 | public function __construct($name, $pool) |
||
35 | |||
36 | /** |
||
37 | * Finds objects in collection |
||
38 | * @param callable $cb Callback called when response received |
||
39 | * @param array $p Hash of properties (offset, limit, opts, tailable, where, col, fields, sort, hint, explain, snapshot, orderby, parse_oplog) |
||
40 | * @callback $cb ( ) |
||
41 | * @return void |
||
42 | */ |
||
43 | public function find($cb, $p = []) |
||
48 | |||
49 | /** |
||
50 | * Finds objects in collection and fires callback when got all objects |
||
51 | * @param callable $cb Callback called when response received |
||
52 | * @param array $p Hash of properties (offset, limit, opts, tailable, where, col, fields, sort, hint, explain, snapshot, orderby, parse_oplog) |
||
53 | * @callback $cb ( ) |
||
54 | * @return void |
||
55 | */ |
||
56 | public function findAll($cb, $p = []) |
||
61 | |||
62 | /** |
||
63 | * Finds one object in collection |
||
64 | * @param callable $cb Callback called when response received |
||
65 | * @param array $p Hash of properties (offset, opts, where, col, fields, sort, hint, explain, snapshot, orderby, parse_oplog) |
||
66 | * @callback $cb ( ) |
||
67 | * @return void |
||
68 | */ |
||
69 | public function findOne($cb, $p = []) |
||
74 | |||
75 | /** |
||
76 | * Counts objects in collection |
||
77 | * @param callable $cb Callback called when response received |
||
78 | * @param array $p Hash of properties (offset, limit, opts, where, col) |
||
79 | * @callback $cb ( ) |
||
80 | * @return void |
||
81 | */ |
||
82 | public function count($cb, $p = []) |
||
87 | |||
88 | /** |
||
89 | * Ensure index |
||
90 | * @param array $keys Keys |
||
91 | * @param array $options Optional. Options |
||
92 | * @param callable $cb Optional. Callback called when response received |
||
93 | * @callback $cb ( ) |
||
94 | * @return void |
||
95 | */ |
||
96 | public function ensureIndex($keys, $options = [], $cb = null) |
||
100 | |||
101 | /** |
||
102 | * Groupping function |
||
103 | * @param callable $cb Callback called when response received |
||
104 | * @param array $p Hash of properties (offset, limit, opts, key, col, reduce, initial) |
||
105 | * @callback $cb ( ) |
||
106 | * @return void |
||
107 | */ |
||
108 | public function group($cb, $p = []) |
||
113 | |||
114 | /** |
||
115 | * Inserts an object |
||
116 | * @param array $doc Data |
||
117 | * @param callable $cb Optional. Callback called when response received |
||
118 | * @param array $params Optional. Params |
||
119 | * @callback $cb ( ) |
||
120 | * @return MongoId |
||
121 | */ |
||
122 | public function insert($doc, $cb = null, $params = null) |
||
126 | |||
127 | /** |
||
128 | * Inserts an object |
||
129 | * @param array $doc Data |
||
130 | * @param callable $cb Optional. Callback called when response received |
||
131 | * @param array $params Optional. Params |
||
132 | * @callback $cb ( ) |
||
133 | * @return MongoId |
||
134 | */ |
||
135 | public function insertOne($doc, $cb = null, $params = null) |
||
139 | |||
140 | /** |
||
141 | * Inserts several documents |
||
142 | * @param array $docs Array of docs |
||
143 | * @param callable $cb Optional. Callback called when response received. |
||
144 | * @param array $params Optional. Params |
||
145 | * @callback $cb ( ) |
||
146 | * @return array IDs |
||
147 | */ |
||
148 | public function insertMulti($docs, $cb = null, $params = null) |
||
152 | |||
153 | /** |
||
154 | * Updates one object in collection |
||
155 | * @param array $cond Conditions |
||
156 | * @param array $data Data |
||
157 | * @param integer $flags Optional. Flags |
||
158 | * @param callable $cb Optional. Callback called when response received |
||
159 | * @param array $params Optional. Params |
||
160 | * @callback $cb ( ) |
||
161 | * @return void |
||
162 | */ |
||
163 | public function update($cond, $data, $flags = 0, $cb = null, $params = null) |
||
167 | |||
168 | |||
169 | /** |
||
170 | * Updates one object in collection |
||
171 | * @param array $cond Conditions |
||
172 | * @param array $data Data |
||
173 | * @param callable $cb Optional. Callback called when response received |
||
174 | * @param array $params Optional. Params |
||
175 | * @callback $cb ( ) |
||
176 | * @return void |
||
177 | */ |
||
178 | public function updateOne($cond, $data, $cb = null, $params = null) |
||
182 | |||
183 | /** |
||
184 | * Updates one object in collection |
||
185 | * @param array $cond Conditions |
||
186 | * @param array $data Data |
||
187 | * @param callable $cb Optional. Callback called when response received |
||
188 | * @param array $params Optional. Params |
||
189 | * @callback $cb ( ) |
||
190 | * @return void |
||
191 | */ |
||
192 | public function updateMulti($cond, $data, $cb = null, $params = null) |
||
196 | |||
197 | /** |
||
198 | * Upserts an object (updates if exists, insert if not exists) |
||
199 | * @param array $cond Conditions |
||
200 | * @param array $data Data |
||
201 | * @param boolean $multi Optional. Multi-flag |
||
202 | * @param callable $cb Optional. Callback called when response received |
||
203 | * @param array $params Optional. Params |
||
204 | * @callback $cb ( ) |
||
205 | * @return void |
||
206 | */ |
||
207 | public function upsert($cond, $data, $multi = false, $cb = null, $params = null) |
||
211 | |||
212 | /** |
||
213 | * Upserts an object (updates if exists, insert if not exists) |
||
214 | * @param array $cond Conditions |
||
215 | * @param array $data Data |
||
216 | * @param callable $cb Optional. Callback called when response received |
||
217 | * @param array $params Optional. Params |
||
218 | * @callback $cb ( ) |
||
219 | * @return void |
||
220 | */ |
||
221 | public function upsertOne($cond, $data, $cb = null, $params = null) |
||
225 | |||
226 | /** |
||
227 | * Upserts an object (updates if exists, insert if not exists) |
||
228 | * @param array $cond Conditions |
||
229 | * @param array $data Data |
||
230 | * @param callable $cb Optional. Callback called when response received |
||
231 | * @param array $params Optional. Params |
||
232 | * @callback $cb ( ) |
||
233 | * @return void |
||
234 | */ |
||
235 | public function upsertMulti($cond, $data, $cb = null, $params = null) |
||
239 | |||
240 | /** |
||
241 | * Removes objects from collection |
||
242 | * @param array $cond Conditions |
||
243 | * @param callable $cb Optional. Callback called when response received |
||
244 | * @param array $params Optional. Params |
||
245 | * @callback $cb ( ) |
||
246 | * @return void |
||
247 | */ |
||
248 | public function remove($cond = [], $cb = null, $params = null) |
||
252 | |||
253 | /** |
||
254 | * Evaluates a code on the server side |
||
255 | * @param string $code Code |
||
256 | * @param callable $cb Callback called when response received |
||
257 | * @callback $cb ( ) |
||
258 | * @return void |
||
259 | */ |
||
260 | public function evaluate($code, $cb) |
||
264 | |||
265 | |||
266 | /** |
||
267 | * Aggregate |
||
268 | * @param array $p Params |
||
269 | * @param callable $cb Callback called when response received |
||
270 | * @callback $cb ( ) |
||
271 | * @return void |
||
272 | */ |
||
273 | public function aggregate($p, $cb) |
||
278 | |||
279 | /** |
||
280 | * Generation autoincrement |
||
281 | * @param callable $cb Called when response received |
||
282 | * @param boolean $plain Plain? |
||
283 | * @callback $cb ( ) |
||
284 | * @return void |
||
285 | */ |
||
286 | public function autoincrement($cb, $plain = false) |
||
299 | |||
300 | /** |
||
301 | * Generation autoincrement |
||
302 | * @param array $p Params |
||
303 | * @param callable $cb Callback called when response received |
||
304 | * @callback $cb ( ) |
||
305 | * @return void |
||
306 | */ |
||
307 | public function findAndModify($p, $cb) |
||
312 | } |
||
313 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.