Skip to content

Commit 114d8f5

Browse files
committed
Move constants from namespace constants to class constants
1 parent 541588f commit 114d8f5

File tree

3 files changed

+19
-35
lines changed

3 files changed

+19
-35
lines changed

src/Collection.php

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,23 @@
77
use MongoDB\Command;
88
use MongoDB\ReadPreference;
99
use MongoDB\WriteBatch;
10-
11-
use MongoDB\QueryFlags;
12-
use MongoDB\CursorType;
1310
/* }}} */
1411

1512
class Collection {
1613
/* {{{ consts & vars */
17-
const INSERT = 0x01;
18-
const UPDATE = 0x02;
19-
const DELETE = 0x04;
14+
const QUERY_FLAG_TAILABLE_CURSOR = 0x02;
15+
const QUERY_FLAG_SLAVE_OKAY = 0x04;
16+
const QUERY_FLAG_OPLOG_REPLY = 0x08;
17+
const QUERY_FLAG_NO_CURSOR_TIMEOUT = 0x10;
18+
const QUERY_FLAG_AWAIT_DATA = 0x20;
19+
const QUERY_FLAG_EXHAUST = 0x40;
20+
const QUERY_FLAG_PARTIAL = 0x80;
21+
22+
23+
const CURSOR_TYPE_NON_TAILABLE = 0x00;
24+
const CURSOR_TYPE_TAILABLE = self::QUERY_FLAG_TAILABLE_CURSOR;
25+
//self::QUERY_FLAG_TAILABLE_CURSOR | self::QUERY_FLAG_AWAIT_DATA;
26+
const CURSOR_TYPE_TAILABLE_AWAIT = 0x22;
2027

2128
const FIND_ONE_AND_RETURN_BEFORE = 0x01;
2229
const FIND_ONE_AND_RETURN_AFTER = 0x02;
@@ -75,11 +82,12 @@ function getFindOptions() { /* {{{ */
7582
/**
7683
* Indicates the type of cursor to use. This value includes both
7784
* the tailable and awaitData options.
78-
* The default is NON_TAILABLE.
85+
* The default is MongoDB\self::CURSOR_TYPE_NON_TAILABLE.
7986
*
87+
* @see MongoDB\CursorType
8088
* @see http://docs.mongodb.org/manual/reference/operator/meta/comment/
8189
*/
82-
"cursorType" => CursorType\NON_TAILABLE,
90+
"cursorType" => self::CURSOR_TYPE_NON_TAILABLE,
8391

8492
/**
8593
* The maximum number of documents to return.
@@ -144,10 +152,10 @@ function getFindOptions() { /* {{{ */
144152
protected function _opQueryFlags($options) { /* {{{ */
145153
$flags = 0;
146154

147-
$flags |= $options["allowPartialResults"] ? QueryFlags\PARTIAL : 0;
155+
$flags |= $options["allowPartialResults"] ? self::QUERY_FLAG_PARTIAL : 0;
148156
$flags |= $options["cursorType"] ? $options["cursorType"] : 0;
149-
$flags |= $options["oplogReplay"] ? QueryFlags\OPLOG_REPLY: 0;
150-
$flags |= $options["noCursorTimeout"] ? QueryFlags\NO_CURSOR_TIMEOUT : 0;
157+
$flags |= $options["oplogReplay"] ? self::QUERY_FLAG_OPLOG_REPLY: 0;
158+
$flags |= $options["noCursorTimeout"] ? self::QUERY_FLAG_NO_CURSOR_TIMEOUT : 0;
151159

152160
return $flags;
153161
} /* }}} */

src/CursorType.php

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/QueryFlags.php

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)