@qp-mongosh/shell-api 0.0.0-dev.5 → 0.0.0-dev.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +2 -2
- package/.eslintrc.js +1 -1
- package/AUTHORS +15 -15
- package/LICENSE +200 -200
- package/bin/report-missing-help.ts +24 -24
- package/bin/report-supported-api.ts +14 -14
- package/lib/abstract-cursor.d.ts +33 -33
- package/lib/abstract-cursor.js +191 -191
- package/lib/aggregation-cursor.d.ts +6 -6
- package/lib/aggregation-cursor.js +19 -19
- package/lib/bulk.d.ts +43 -43
- package/lib/bulk.js +223 -223
- package/lib/change-stream-cursor.d.ts +28 -28
- package/lib/change-stream-cursor.js +111 -111
- package/lib/collection.d.ts +95 -95
- package/lib/collection.js +964 -964
- package/lib/cursor.d.ts +32 -32
- package/lib/cursor.js +215 -215
- package/lib/database.d.ts +116 -116
- package/lib/database.js +1223 -1223
- package/lib/dbquery.d.ts +8 -8
- package/lib/dbquery.js +28 -28
- package/lib/decorators.d.ts +73 -73
- package/lib/decorators.js +395 -395
- package/lib/enums.d.ts +28 -28
- package/lib/enums.js +33 -33
- package/lib/error-codes.d.ts +12 -12
- package/lib/error-codes.js +19 -19
- package/lib/explainable-cursor.d.ts +11 -11
- package/lib/explainable-cursor.js +31 -31
- package/lib/explainable.d.ts +32 -32
- package/lib/explainable.js +166 -166
- package/lib/field-level-encryption.d.ts +50 -50
- package/lib/field-level-encryption.js +176 -176
- package/lib/help.d.ts +22 -22
- package/lib/help.js +26 -26
- package/lib/helpers.d.ts +71 -71
- package/lib/helpers.js +588 -588
- package/lib/index.d.ts +16 -16
- package/lib/index.js +45 -45
- package/lib/interruptor.d.ts +19 -19
- package/lib/interruptor.js +62 -62
- package/lib/mongo-errors.d.ts +5 -5
- package/lib/mongo-errors.js +37 -37
- package/lib/mongo.d.ts +75 -75
- package/lib/mongo.js +476 -476
- package/lib/no-db.d.ts +5 -5
- package/lib/no-db.js +28 -28
- package/lib/plan-cache.d.ts +16 -16
- package/lib/plan-cache.js +70 -70
- package/lib/replica-set.d.ts +45 -45
- package/lib/replica-set.js +314 -314
- package/lib/result.d.ts +61 -61
- package/lib/result.js +104 -104
- package/lib/session.d.ts +25 -25
- package/lib/session.js +88 -88
- package/lib/shard.d.ts +42 -42
- package/lib/shard.js +414 -414
- package/lib/shell-api.d.ts +52 -52
- package/lib/shell-api.js +298 -298
- package/lib/shell-bson.d.ts +40 -40
- package/lib/shell-bson.js +159 -159
- package/lib/shell-instance-state.d.ts +77 -77
- package/lib/shell-instance-state.js +392 -392
- package/package.json +47 -47
- package/tsconfig.lint.json +8 -8
package/lib/cursor.d.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import type { FindCursor as ServiceProviderCursor, Document, CollationOptions, ReadPreferenceLike, ReadConcernLevel, TagSet, HedgeOptions } from '@qp-mongosh/service-provider-core';
|
|
2
|
-
import type Mongo from './mongo';
|
|
3
|
-
import { AbstractCursor } from './abstract-cursor';
|
|
4
|
-
export default class Cursor extends AbstractCursor<ServiceProviderCursor> {
|
|
5
|
-
_tailable: boolean;
|
|
6
|
-
constructor(mongo: Mongo, cursor: ServiceProviderCursor);
|
|
7
|
-
private _addFlag;
|
|
8
|
-
addOption(optionFlagNumber: number): Cursor;
|
|
9
|
-
allowDiskUse(): Cursor;
|
|
10
|
-
allowPartialResults(): Cursor;
|
|
11
|
-
collation(spec: CollationOptions): Cursor;
|
|
12
|
-
comment(cmt: string): Cursor;
|
|
13
|
-
count(): Promise<number>;
|
|
14
|
-
hasNext(): Promise<boolean>;
|
|
15
|
-
hint(index: string): Cursor;
|
|
16
|
-
limit(value: number): Cursor;
|
|
17
|
-
max(indexBounds: Document): Cursor;
|
|
18
|
-
maxAwaitTimeMS(value: number): Cursor;
|
|
19
|
-
min(indexBounds: Document): Cursor;
|
|
20
|
-
next(): Promise<Document | null>;
|
|
21
|
-
noCursorTimeout(): Cursor;
|
|
22
|
-
oplogReplay(): Cursor;
|
|
23
|
-
readPref(mode: ReadPreferenceLike, tagSet?: TagSet[], hedgeOptions?: HedgeOptions): Cursor;
|
|
24
|
-
returnKey(enabled: boolean): Cursor;
|
|
25
|
-
size(): Promise<number>;
|
|
26
|
-
tailable(opts?: {
|
|
27
|
-
awaitData: boolean;
|
|
28
|
-
}): Cursor;
|
|
29
|
-
maxScan(): void;
|
|
30
|
-
showRecordId(): Cursor;
|
|
31
|
-
readConcern(level: ReadConcernLevel): Cursor;
|
|
32
|
-
}
|
|
1
|
+
import type { FindCursor as ServiceProviderCursor, Document, CollationOptions, ReadPreferenceLike, ReadConcernLevel, TagSet, HedgeOptions } from '@qp-mongosh/service-provider-core';
|
|
2
|
+
import type Mongo from './mongo';
|
|
3
|
+
import { AbstractCursor } from './abstract-cursor';
|
|
4
|
+
export default class Cursor extends AbstractCursor<ServiceProviderCursor> {
|
|
5
|
+
_tailable: boolean;
|
|
6
|
+
constructor(mongo: Mongo, cursor: ServiceProviderCursor);
|
|
7
|
+
private _addFlag;
|
|
8
|
+
addOption(optionFlagNumber: number): Cursor;
|
|
9
|
+
allowDiskUse(): Cursor;
|
|
10
|
+
allowPartialResults(): Cursor;
|
|
11
|
+
collation(spec: CollationOptions): Cursor;
|
|
12
|
+
comment(cmt: string): Cursor;
|
|
13
|
+
count(): Promise<number>;
|
|
14
|
+
hasNext(): Promise<boolean>;
|
|
15
|
+
hint(index: string): Cursor;
|
|
16
|
+
limit(value: number): Cursor;
|
|
17
|
+
max(indexBounds: Document): Cursor;
|
|
18
|
+
maxAwaitTimeMS(value: number): Cursor;
|
|
19
|
+
min(indexBounds: Document): Cursor;
|
|
20
|
+
next(): Promise<Document | null>;
|
|
21
|
+
noCursorTimeout(): Cursor;
|
|
22
|
+
oplogReplay(): Cursor;
|
|
23
|
+
readPref(mode: ReadPreferenceLike, tagSet?: TagSet[], hedgeOptions?: HedgeOptions): Cursor;
|
|
24
|
+
returnKey(enabled: boolean): Cursor;
|
|
25
|
+
size(): Promise<number>;
|
|
26
|
+
tailable(opts?: {
|
|
27
|
+
awaitData: boolean;
|
|
28
|
+
}): Cursor;
|
|
29
|
+
maxScan(): void;
|
|
30
|
+
showRecordId(): Cursor;
|
|
31
|
+
readConcern(level: ReadConcernLevel): Cursor;
|
|
32
|
+
}
|
package/lib/cursor.js
CHANGED
|
@@ -1,216 +1,216 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
const errors_1 = require("@qp-mongosh/errors");
|
|
10
|
-
const decorators_1 = require("./decorators");
|
|
11
|
-
const enums_1 = require("./enums");
|
|
12
|
-
const abstract_cursor_1 = require("./abstract-cursor");
|
|
13
|
-
let Cursor = class Cursor extends abstract_cursor_1.AbstractCursor {
|
|
14
|
-
constructor(mongo, cursor) {
|
|
15
|
-
super(mongo, cursor);
|
|
16
|
-
this._tailable = false;
|
|
17
|
-
}
|
|
18
|
-
_addFlag(flag) {
|
|
19
|
-
this._cursor.addCursorFlag(flag, true);
|
|
20
|
-
}
|
|
21
|
-
addOption(optionFlagNumber) {
|
|
22
|
-
if (optionFlagNumber === 4) {
|
|
23
|
-
throw new errors_1.MongoshUnimplementedError('the slaveOk option is not supported.', errors_1.CommonErrors.NotImplemented);
|
|
24
|
-
}
|
|
25
|
-
const optionFlag = enums_1.CURSOR_FLAGS[optionFlagNumber];
|
|
26
|
-
if (!optionFlag) {
|
|
27
|
-
throw new errors_1.MongoshInvalidInputError(`Unknown option flag number: ${optionFlagNumber}.`, errors_1.CommonErrors.InvalidArgument);
|
|
28
|
-
}
|
|
29
|
-
this._cursor.addCursorFlag(optionFlag, true);
|
|
30
|
-
return this;
|
|
31
|
-
}
|
|
32
|
-
allowDiskUse() {
|
|
33
|
-
this._cursor.allowDiskUse();
|
|
34
|
-
return this;
|
|
35
|
-
}
|
|
36
|
-
allowPartialResults() {
|
|
37
|
-
this._addFlag('partial');
|
|
38
|
-
return this;
|
|
39
|
-
}
|
|
40
|
-
collation(spec) {
|
|
41
|
-
this._cursor.collation(spec);
|
|
42
|
-
return this;
|
|
43
|
-
}
|
|
44
|
-
comment(cmt) {
|
|
45
|
-
this._cursor.comment(cmt);
|
|
46
|
-
return this;
|
|
47
|
-
}
|
|
48
|
-
async count() {
|
|
49
|
-
return this._cursor.count();
|
|
50
|
-
}
|
|
51
|
-
async hasNext() {
|
|
52
|
-
if (this._tailable) {
|
|
53
|
-
await this._instanceState.printWarning('If this is a tailable cursor with awaitData, and there are no documents in the batch, this method ' +
|
|
54
|
-
'will will block. Use tryNext if you want to check if there are any documents without waiting.');
|
|
55
|
-
}
|
|
56
|
-
return super.hasNext();
|
|
57
|
-
}
|
|
58
|
-
hint(index) {
|
|
59
|
-
this._cursor.hint(index);
|
|
60
|
-
return this;
|
|
61
|
-
}
|
|
62
|
-
limit(value) {
|
|
63
|
-
this._cursor.limit(value);
|
|
64
|
-
return this;
|
|
65
|
-
}
|
|
66
|
-
max(indexBounds) {
|
|
67
|
-
this._cursor.max(indexBounds);
|
|
68
|
-
return this;
|
|
69
|
-
}
|
|
70
|
-
maxAwaitTimeMS(value) {
|
|
71
|
-
this._cursor.maxAwaitTimeMS(value);
|
|
72
|
-
return this;
|
|
73
|
-
}
|
|
74
|
-
min(indexBounds) {
|
|
75
|
-
this._cursor.min(indexBounds);
|
|
76
|
-
return this;
|
|
77
|
-
}
|
|
78
|
-
async next() {
|
|
79
|
-
if (this._tailable) {
|
|
80
|
-
await this._instanceState.printWarning('If this is a tailable cursor with awaitData, and there are no documents in the batch, this' +
|
|
81
|
-
' method will will block. Use tryNext if you want to check if there are any documents without waiting.');
|
|
82
|
-
}
|
|
83
|
-
return super.next();
|
|
84
|
-
}
|
|
85
|
-
noCursorTimeout() {
|
|
86
|
-
this._addFlag('noCursorTimeout');
|
|
87
|
-
return this;
|
|
88
|
-
}
|
|
89
|
-
oplogReplay() {
|
|
90
|
-
this._addFlag('oplogReplay');
|
|
91
|
-
return this;
|
|
92
|
-
}
|
|
93
|
-
readPref(mode, tagSet, hedgeOptions) {
|
|
94
|
-
let pref;
|
|
95
|
-
if (tagSet || hedgeOptions) {
|
|
96
|
-
pref = this._mongo._serviceProvider.readPreferenceFromOptions({
|
|
97
|
-
readPreference: mode,
|
|
98
|
-
readPreferenceTags: tagSet,
|
|
99
|
-
hedge: hedgeOptions
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
pref = mode;
|
|
104
|
-
}
|
|
105
|
-
this._cursor = this._cursor.withReadPreference(pref);
|
|
106
|
-
return this;
|
|
107
|
-
}
|
|
108
|
-
returnKey(enabled) {
|
|
109
|
-
this._cursor.returnKey(enabled);
|
|
110
|
-
return this;
|
|
111
|
-
}
|
|
112
|
-
async size() {
|
|
113
|
-
return this._cursor.count();
|
|
114
|
-
}
|
|
115
|
-
tailable(opts = { awaitData: false }) {
|
|
116
|
-
this._tailable = true;
|
|
117
|
-
this._addFlag('tailable');
|
|
118
|
-
if (opts.awaitData) {
|
|
119
|
-
this._addFlag('awaitData');
|
|
120
|
-
}
|
|
121
|
-
return this;
|
|
122
|
-
}
|
|
123
|
-
maxScan() {
|
|
124
|
-
throw new errors_1.MongoshDeprecatedError('`maxScan()` was removed because it was deprecated in MongoDB 4.0');
|
|
125
|
-
}
|
|
126
|
-
showRecordId() {
|
|
127
|
-
this._cursor.showRecordId(true);
|
|
128
|
-
return this;
|
|
129
|
-
}
|
|
130
|
-
readConcern(level) {
|
|
131
|
-
this._cursor = this._cursor.withReadConcern({ level });
|
|
132
|
-
return this;
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
__decorate([
|
|
136
|
-
(0, decorators_1.returnType)('Cursor'),
|
|
137
|
-
(0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '3.2.0'])
|
|
138
|
-
], Cursor.prototype, "addOption", null);
|
|
139
|
-
__decorate([
|
|
140
|
-
(0, decorators_1.returnType)('Cursor'),
|
|
141
|
-
(0, decorators_1.serverVersions)(['4.4.0', enums_1.ServerVersions.latest])
|
|
142
|
-
], Cursor.prototype, "allowDiskUse", null);
|
|
143
|
-
__decorate([
|
|
144
|
-
(0, decorators_1.returnType)('Cursor')
|
|
145
|
-
], Cursor.prototype, "allowPartialResults", null);
|
|
146
|
-
__decorate([
|
|
147
|
-
(0, decorators_1.returnType)('Cursor'),
|
|
148
|
-
(0, decorators_1.serverVersions)(['3.4.0', enums_1.ServerVersions.latest])
|
|
149
|
-
], Cursor.prototype, "collation", null);
|
|
150
|
-
__decorate([
|
|
151
|
-
(0, decorators_1.returnType)('Cursor'),
|
|
152
|
-
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest])
|
|
153
|
-
], Cursor.prototype, "comment", null);
|
|
154
|
-
__decorate([
|
|
155
|
-
(0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '4.0.0']),
|
|
156
|
-
decorators_1.returnsPromise
|
|
157
|
-
], Cursor.prototype, "count", null);
|
|
158
|
-
__decorate([
|
|
159
|
-
decorators_1.returnsPromise
|
|
160
|
-
], Cursor.prototype, "hasNext", null);
|
|
161
|
-
__decorate([
|
|
162
|
-
(0, decorators_1.returnType)('Cursor')
|
|
163
|
-
], Cursor.prototype, "hint", null);
|
|
164
|
-
__decorate([
|
|
165
|
-
(0, decorators_1.returnType)('Cursor')
|
|
166
|
-
], Cursor.prototype, "limit", null);
|
|
167
|
-
__decorate([
|
|
168
|
-
(0, decorators_1.returnType)('Cursor')
|
|
169
|
-
], Cursor.prototype, "max", null);
|
|
170
|
-
__decorate([
|
|
171
|
-
(0, decorators_1.returnType)('Cursor'),
|
|
172
|
-
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest])
|
|
173
|
-
], Cursor.prototype, "maxAwaitTimeMS", null);
|
|
174
|
-
__decorate([
|
|
175
|
-
(0, decorators_1.returnType)('Cursor')
|
|
176
|
-
], Cursor.prototype, "min", null);
|
|
177
|
-
__decorate([
|
|
178
|
-
decorators_1.returnsPromise
|
|
179
|
-
], Cursor.prototype, "next", null);
|
|
180
|
-
__decorate([
|
|
181
|
-
(0, decorators_1.returnType)('Cursor')
|
|
182
|
-
], Cursor.prototype, "noCursorTimeout", null);
|
|
183
|
-
__decorate([
|
|
184
|
-
(0, decorators_1.returnType)('Cursor')
|
|
185
|
-
], Cursor.prototype, "oplogReplay", null);
|
|
186
|
-
__decorate([
|
|
187
|
-
(0, decorators_1.returnType)('Cursor')
|
|
188
|
-
], Cursor.prototype, "readPref", null);
|
|
189
|
-
__decorate([
|
|
190
|
-
(0, decorators_1.returnType)('Cursor'),
|
|
191
|
-
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest])
|
|
192
|
-
], Cursor.prototype, "returnKey", null);
|
|
193
|
-
__decorate([
|
|
194
|
-
decorators_1.returnsPromise
|
|
195
|
-
], Cursor.prototype, "size", null);
|
|
196
|
-
__decorate([
|
|
197
|
-
(0, decorators_1.returnType)('Cursor'),
|
|
198
|
-
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
199
|
-
(0, decorators_1.apiVersions)([])
|
|
200
|
-
], Cursor.prototype, "tailable", null);
|
|
201
|
-
__decorate([
|
|
202
|
-
decorators_1.deprecated,
|
|
203
|
-
(0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '4.0.0'])
|
|
204
|
-
], Cursor.prototype, "maxScan", null);
|
|
205
|
-
__decorate([
|
|
206
|
-
(0, decorators_1.returnType)('Cursor'),
|
|
207
|
-
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest])
|
|
208
|
-
], Cursor.prototype, "showRecordId", null);
|
|
209
|
-
__decorate([
|
|
210
|
-
(0, decorators_1.returnType)('Cursor')
|
|
211
|
-
], Cursor.prototype, "readConcern", null);
|
|
212
|
-
Cursor = __decorate([
|
|
213
|
-
decorators_1.shellApiClassDefault
|
|
214
|
-
], Cursor);
|
|
215
|
-
exports.default = Cursor;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
const errors_1 = require("@qp-mongosh/errors");
|
|
10
|
+
const decorators_1 = require("./decorators");
|
|
11
|
+
const enums_1 = require("./enums");
|
|
12
|
+
const abstract_cursor_1 = require("./abstract-cursor");
|
|
13
|
+
let Cursor = class Cursor extends abstract_cursor_1.AbstractCursor {
|
|
14
|
+
constructor(mongo, cursor) {
|
|
15
|
+
super(mongo, cursor);
|
|
16
|
+
this._tailable = false;
|
|
17
|
+
}
|
|
18
|
+
_addFlag(flag) {
|
|
19
|
+
this._cursor.addCursorFlag(flag, true);
|
|
20
|
+
}
|
|
21
|
+
addOption(optionFlagNumber) {
|
|
22
|
+
if (optionFlagNumber === 4) {
|
|
23
|
+
throw new errors_1.MongoshUnimplementedError('the slaveOk option is not supported.', errors_1.CommonErrors.NotImplemented);
|
|
24
|
+
}
|
|
25
|
+
const optionFlag = enums_1.CURSOR_FLAGS[optionFlagNumber];
|
|
26
|
+
if (!optionFlag) {
|
|
27
|
+
throw new errors_1.MongoshInvalidInputError(`Unknown option flag number: ${optionFlagNumber}.`, errors_1.CommonErrors.InvalidArgument);
|
|
28
|
+
}
|
|
29
|
+
this._cursor.addCursorFlag(optionFlag, true);
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
allowDiskUse() {
|
|
33
|
+
this._cursor.allowDiskUse();
|
|
34
|
+
return this;
|
|
35
|
+
}
|
|
36
|
+
allowPartialResults() {
|
|
37
|
+
this._addFlag('partial');
|
|
38
|
+
return this;
|
|
39
|
+
}
|
|
40
|
+
collation(spec) {
|
|
41
|
+
this._cursor.collation(spec);
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
comment(cmt) {
|
|
45
|
+
this._cursor.comment(cmt);
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
async count() {
|
|
49
|
+
return this._cursor.count();
|
|
50
|
+
}
|
|
51
|
+
async hasNext() {
|
|
52
|
+
if (this._tailable) {
|
|
53
|
+
await this._instanceState.printWarning('If this is a tailable cursor with awaitData, and there are no documents in the batch, this method ' +
|
|
54
|
+
'will will block. Use tryNext if you want to check if there are any documents without waiting.');
|
|
55
|
+
}
|
|
56
|
+
return super.hasNext();
|
|
57
|
+
}
|
|
58
|
+
hint(index) {
|
|
59
|
+
this._cursor.hint(index);
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
limit(value) {
|
|
63
|
+
this._cursor.limit(value);
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
max(indexBounds) {
|
|
67
|
+
this._cursor.max(indexBounds);
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
maxAwaitTimeMS(value) {
|
|
71
|
+
this._cursor.maxAwaitTimeMS(value);
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
min(indexBounds) {
|
|
75
|
+
this._cursor.min(indexBounds);
|
|
76
|
+
return this;
|
|
77
|
+
}
|
|
78
|
+
async next() {
|
|
79
|
+
if (this._tailable) {
|
|
80
|
+
await this._instanceState.printWarning('If this is a tailable cursor with awaitData, and there are no documents in the batch, this' +
|
|
81
|
+
' method will will block. Use tryNext if you want to check if there are any documents without waiting.');
|
|
82
|
+
}
|
|
83
|
+
return super.next();
|
|
84
|
+
}
|
|
85
|
+
noCursorTimeout() {
|
|
86
|
+
this._addFlag('noCursorTimeout');
|
|
87
|
+
return this;
|
|
88
|
+
}
|
|
89
|
+
oplogReplay() {
|
|
90
|
+
this._addFlag('oplogReplay');
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
93
|
+
readPref(mode, tagSet, hedgeOptions) {
|
|
94
|
+
let pref;
|
|
95
|
+
if (tagSet || hedgeOptions) {
|
|
96
|
+
pref = this._mongo._serviceProvider.readPreferenceFromOptions({
|
|
97
|
+
readPreference: mode,
|
|
98
|
+
readPreferenceTags: tagSet,
|
|
99
|
+
hedge: hedgeOptions
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
pref = mode;
|
|
104
|
+
}
|
|
105
|
+
this._cursor = this._cursor.withReadPreference(pref);
|
|
106
|
+
return this;
|
|
107
|
+
}
|
|
108
|
+
returnKey(enabled) {
|
|
109
|
+
this._cursor.returnKey(enabled);
|
|
110
|
+
return this;
|
|
111
|
+
}
|
|
112
|
+
async size() {
|
|
113
|
+
return this._cursor.count();
|
|
114
|
+
}
|
|
115
|
+
tailable(opts = { awaitData: false }) {
|
|
116
|
+
this._tailable = true;
|
|
117
|
+
this._addFlag('tailable');
|
|
118
|
+
if (opts.awaitData) {
|
|
119
|
+
this._addFlag('awaitData');
|
|
120
|
+
}
|
|
121
|
+
return this;
|
|
122
|
+
}
|
|
123
|
+
maxScan() {
|
|
124
|
+
throw new errors_1.MongoshDeprecatedError('`maxScan()` was removed because it was deprecated in MongoDB 4.0');
|
|
125
|
+
}
|
|
126
|
+
showRecordId() {
|
|
127
|
+
this._cursor.showRecordId(true);
|
|
128
|
+
return this;
|
|
129
|
+
}
|
|
130
|
+
readConcern(level) {
|
|
131
|
+
this._cursor = this._cursor.withReadConcern({ level });
|
|
132
|
+
return this;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
__decorate([
|
|
136
|
+
(0, decorators_1.returnType)('Cursor'),
|
|
137
|
+
(0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '3.2.0'])
|
|
138
|
+
], Cursor.prototype, "addOption", null);
|
|
139
|
+
__decorate([
|
|
140
|
+
(0, decorators_1.returnType)('Cursor'),
|
|
141
|
+
(0, decorators_1.serverVersions)(['4.4.0', enums_1.ServerVersions.latest])
|
|
142
|
+
], Cursor.prototype, "allowDiskUse", null);
|
|
143
|
+
__decorate([
|
|
144
|
+
(0, decorators_1.returnType)('Cursor')
|
|
145
|
+
], Cursor.prototype, "allowPartialResults", null);
|
|
146
|
+
__decorate([
|
|
147
|
+
(0, decorators_1.returnType)('Cursor'),
|
|
148
|
+
(0, decorators_1.serverVersions)(['3.4.0', enums_1.ServerVersions.latest])
|
|
149
|
+
], Cursor.prototype, "collation", null);
|
|
150
|
+
__decorate([
|
|
151
|
+
(0, decorators_1.returnType)('Cursor'),
|
|
152
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest])
|
|
153
|
+
], Cursor.prototype, "comment", null);
|
|
154
|
+
__decorate([
|
|
155
|
+
(0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '4.0.0']),
|
|
156
|
+
decorators_1.returnsPromise
|
|
157
|
+
], Cursor.prototype, "count", null);
|
|
158
|
+
__decorate([
|
|
159
|
+
decorators_1.returnsPromise
|
|
160
|
+
], Cursor.prototype, "hasNext", null);
|
|
161
|
+
__decorate([
|
|
162
|
+
(0, decorators_1.returnType)('Cursor')
|
|
163
|
+
], Cursor.prototype, "hint", null);
|
|
164
|
+
__decorate([
|
|
165
|
+
(0, decorators_1.returnType)('Cursor')
|
|
166
|
+
], Cursor.prototype, "limit", null);
|
|
167
|
+
__decorate([
|
|
168
|
+
(0, decorators_1.returnType)('Cursor')
|
|
169
|
+
], Cursor.prototype, "max", null);
|
|
170
|
+
__decorate([
|
|
171
|
+
(0, decorators_1.returnType)('Cursor'),
|
|
172
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest])
|
|
173
|
+
], Cursor.prototype, "maxAwaitTimeMS", null);
|
|
174
|
+
__decorate([
|
|
175
|
+
(0, decorators_1.returnType)('Cursor')
|
|
176
|
+
], Cursor.prototype, "min", null);
|
|
177
|
+
__decorate([
|
|
178
|
+
decorators_1.returnsPromise
|
|
179
|
+
], Cursor.prototype, "next", null);
|
|
180
|
+
__decorate([
|
|
181
|
+
(0, decorators_1.returnType)('Cursor')
|
|
182
|
+
], Cursor.prototype, "noCursorTimeout", null);
|
|
183
|
+
__decorate([
|
|
184
|
+
(0, decorators_1.returnType)('Cursor')
|
|
185
|
+
], Cursor.prototype, "oplogReplay", null);
|
|
186
|
+
__decorate([
|
|
187
|
+
(0, decorators_1.returnType)('Cursor')
|
|
188
|
+
], Cursor.prototype, "readPref", null);
|
|
189
|
+
__decorate([
|
|
190
|
+
(0, decorators_1.returnType)('Cursor'),
|
|
191
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest])
|
|
192
|
+
], Cursor.prototype, "returnKey", null);
|
|
193
|
+
__decorate([
|
|
194
|
+
decorators_1.returnsPromise
|
|
195
|
+
], Cursor.prototype, "size", null);
|
|
196
|
+
__decorate([
|
|
197
|
+
(0, decorators_1.returnType)('Cursor'),
|
|
198
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest]),
|
|
199
|
+
(0, decorators_1.apiVersions)([])
|
|
200
|
+
], Cursor.prototype, "tailable", null);
|
|
201
|
+
__decorate([
|
|
202
|
+
decorators_1.deprecated,
|
|
203
|
+
(0, decorators_1.serverVersions)([enums_1.ServerVersions.earliest, '4.0.0'])
|
|
204
|
+
], Cursor.prototype, "maxScan", null);
|
|
205
|
+
__decorate([
|
|
206
|
+
(0, decorators_1.returnType)('Cursor'),
|
|
207
|
+
(0, decorators_1.serverVersions)(['3.2.0', enums_1.ServerVersions.latest])
|
|
208
|
+
], Cursor.prototype, "showRecordId", null);
|
|
209
|
+
__decorate([
|
|
210
|
+
(0, decorators_1.returnType)('Cursor')
|
|
211
|
+
], Cursor.prototype, "readConcern", null);
|
|
212
|
+
Cursor = __decorate([
|
|
213
|
+
decorators_1.shellApiClassDefault
|
|
214
|
+
], Cursor);
|
|
215
|
+
exports.default = Cursor;
|
|
216
216
|
//# sourceMappingURL=cursor.js.map
|