mongodb 3.0.3 → 3.0.7
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/.eslintrc +2 -1
- package/CHANGES_3.0.0.md +28 -0
- package/CODE_OF_CONDUCT.md +80 -0
- package/CONTRIBUTING.md +29 -0
- package/HISTORY.md +61 -0
- package/conf.json +0 -1
- package/index.js +6 -4
- package/lib/admin.js +6 -49
- package/lib/aggregation_cursor.js +7 -46
- package/lib/apm.js +21 -629
- package/lib/bulk/common.js +0 -23
- package/lib/bulk/ordered.js +15 -22
- package/lib/bulk/unordered.js +15 -22
- package/lib/collection.js +59 -182
- package/lib/command_cursor.js +11 -34
- package/lib/cursor.js +48 -90
- package/lib/db.js +42 -122
- package/lib/gridfs/grid_store.js +12 -61
- package/lib/mongo_client.js +40 -31
- package/lib/topologies/mongos.js +47 -41
- package/lib/topologies/replset.js +46 -39
- package/lib/topologies/server.js +46 -40
- package/lib/topologies/topology_base.js +2 -4
- package/lib/url_parser.js +10 -0
- package/lib/utils.js +83 -30
- package/package.json +5 -5
- package/yarn.lock +375 -559
- package/lib/metadata.js +0 -70
package/.eslintrc
CHANGED
package/CHANGES_3.0.0.md
CHANGED
|
@@ -101,6 +101,17 @@ MongoClient.connect('mongodb://localhost:27017/test', (err, client) => {
|
|
|
101
101
|
});
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
+
The database specified in the connection string will be set as the default database of the
|
|
105
|
+
returned client. The default database is now used if no parameter is passed to
|
|
106
|
+
`MongoClient.prototype.db`, for example:
|
|
107
|
+
|
|
108
|
+
```js
|
|
109
|
+
MongoClient.connect('mongodb://localhost:27017/test')
|
|
110
|
+
.then(client => client.db().collection('foo').insert({ a: 42 })
|
|
111
|
+
.then(() => ...)
|
|
112
|
+
.catc(err => ...);
|
|
113
|
+
```
|
|
114
|
+
|
|
104
115
|
## Other Changes
|
|
105
116
|
|
|
106
117
|
Below are more updates to the driver in the 3.0.0 release.
|
|
@@ -173,6 +184,23 @@ in on the options object . Additionally, `find` does not support individual opti
|
|
|
173
184
|
`limit` as positional parameters. You must either pass in these parameters in the `options` object,
|
|
174
185
|
or add them via `Cursor` methods like `Cursor.prototype.skip`.
|
|
175
186
|
|
|
187
|
+
2.x syntax:
|
|
188
|
+
|
|
189
|
+
```js
|
|
190
|
+
const cursor = coll.find({ a: 42 }, { someField: 1 });
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
3.x syntax:
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
const cursor = coll.find({ a: 42 }).project({ someField: 1 });
|
|
197
|
+
|
|
198
|
+
/* OR */
|
|
199
|
+
|
|
200
|
+
const cursor = coll.find({ a: 42 }, { projection: { someField: 1 } });
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
|
|
176
204
|
### `Collection.prototype.aggregate`
|
|
177
205
|
|
|
178
206
|
`Collection.prototype.aggregate` no longer accepts variadic arguments. While this
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
## Code of Conduct
|
|
2
|
+
|
|
3
|
+
### Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age,
|
|
8
|
+
body size, disability, ethnicity, gender identity and expression, level of
|
|
9
|
+
experience, nationality, personal appearance, race, religion, or sexual
|
|
10
|
+
identity and orientation.
|
|
11
|
+
|
|
12
|
+
Please also take a moment to review [MongoDB's core values][mdb-core-values].
|
|
13
|
+
|
|
14
|
+
### Our Standards
|
|
15
|
+
|
|
16
|
+
Examples of behavior that contributes to creating a positive environment
|
|
17
|
+
include:
|
|
18
|
+
|
|
19
|
+
* Using welcoming and inclusive language
|
|
20
|
+
* Being respectful of differing viewpoints and experiences
|
|
21
|
+
* Gracefully accepting constructive criticism
|
|
22
|
+
* Focusing on what is best for the community
|
|
23
|
+
* Showing empathy towards other community members
|
|
24
|
+
|
|
25
|
+
Examples of unacceptable behavior by participants include:
|
|
26
|
+
|
|
27
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
28
|
+
advances
|
|
29
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
30
|
+
* Public or private harassment
|
|
31
|
+
* Publishing others' private information, such as a physical or electronic
|
|
32
|
+
address, without explicit permission
|
|
33
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
34
|
+
professional setting
|
|
35
|
+
|
|
36
|
+
### Our Responsibilities
|
|
37
|
+
|
|
38
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
39
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
40
|
+
response to any instances of unacceptable behavior.
|
|
41
|
+
|
|
42
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
43
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
44
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
45
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
46
|
+
threatening, offensive, or harmful.
|
|
47
|
+
|
|
48
|
+
### Scope
|
|
49
|
+
|
|
50
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
51
|
+
when an individual is representing the project or its community. Examples of
|
|
52
|
+
representing a project or community include using an official project e-mail
|
|
53
|
+
address, posting via an official social media account, or acting as an
|
|
54
|
+
appointed representative at an online or offline event. Representation of a
|
|
55
|
+
project may be further defined and clarified by project maintainers.
|
|
56
|
+
|
|
57
|
+
### Enforcement
|
|
58
|
+
|
|
59
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
60
|
+
reported by contacting the project team, or by
|
|
61
|
+
[contacting GitHub][github-report-abuse]. All complaints will be reviewed
|
|
62
|
+
and investigated and will result in a response that is deemed necessary and
|
|
63
|
+
appropriate to the circumstances. The project team is obligated to maintain
|
|
64
|
+
confidentiality with regard to the reporter of an incident.
|
|
65
|
+
Further details of specific enforcement policies may be posted separately.
|
|
66
|
+
|
|
67
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
68
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
69
|
+
members of the project's leadership.
|
|
70
|
+
|
|
71
|
+
### Attribution
|
|
72
|
+
|
|
73
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
74
|
+
version [1.4][version].
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
[github-report-abuse]: https://github.com/contact/report-abuse
|
|
78
|
+
[homepage]: https://www.contributor-covenant.org/
|
|
79
|
+
[mdb-core-values]: https://www.mongodb.com/company/
|
|
80
|
+
[version]: https://www.contributor-covenant.org/version/1/4/
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
When contributing to this repository, please first discuss the change you wish
|
|
4
|
+
to make via issue, pull request, or any other method with the owners of this
|
|
5
|
+
repository before making a change.
|
|
6
|
+
|
|
7
|
+
Please note we have a [code of conduct][code-of-conduct],
|
|
8
|
+
please follow it in all your interactions with the project.
|
|
9
|
+
|
|
10
|
+
## Commit messages
|
|
11
|
+
|
|
12
|
+
Please follow the [Angular commit style][angular-commit-style].
|
|
13
|
+
This helps the team automate [CHANGELOG.md][changelog] generation.
|
|
14
|
+
|
|
15
|
+
## Pull Request Process
|
|
16
|
+
|
|
17
|
+
1. Update the README.md or similar documentation with details of changes you
|
|
18
|
+
wish to make, if applicable.
|
|
19
|
+
2. Add any appropriate tests.
|
|
20
|
+
3. Make your code or other changes.
|
|
21
|
+
4. Review guidelines such as
|
|
22
|
+
[How to write the perfect pull request][github-perfect-pr], thanks!
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
[angular-commit-style]: https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits
|
|
26
|
+
[changelog]: CHANGELOG.md
|
|
27
|
+
[code-of-conduct]: CODE_OF_CONDUCT.md
|
|
28
|
+
[github-perfect-pr]: https://blog.github.com/2015-01-21-how-to-write-the-perfect-pull-request/
|
|
29
|
+
[mdb-core-values]: https://www.mongodb.com/company/
|
package/HISTORY.md
CHANGED
|
@@ -1,3 +1,64 @@
|
|
|
1
|
+
<a name="3.0.7"></a>
|
|
2
|
+
## [3.0.7](https://github.com/mongodb/node-mongodb-native/compare/v3.0.6...v3.0.7) (2018-04-17)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
<a name="3.0.6"></a>
|
|
7
|
+
## [3.0.6](https://github.com/mongodb/node-mongodb-native/compare/v3.0.5...v3.0.6) (2018-04-09)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* **db:** ensure `dropDatabase` always uses primary read preference ([e62e5c9](https://github.com/mongodb/node-mongodb-native/commit/e62e5c9))
|
|
13
|
+
* **driverBench:** driverBench has default options object now ([c557817](https://github.com/mongodb/node-mongodb-native/commit/c557817))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
### Features
|
|
17
|
+
|
|
18
|
+
* **command-monitoring:** support enabling command monitoring ([5903680](https://github.com/mongodb/node-mongodb-native/commit/5903680))
|
|
19
|
+
* **core:** update to mongodb-core v3.0.6 ([cfdd0ae](https://github.com/mongodb/node-mongodb-native/commit/cfdd0ae))
|
|
20
|
+
* **driverBench:** Implementing DriverBench ([d10fbad](https://github.com/mongodb/node-mongodb-native/commit/d10fbad))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
<a name="3.0.5"></a>
|
|
25
|
+
## [3.0.5](https://github.com/mongodb/node-mongodb-native/compare/v3.0.4...v3.0.5) (2018-03-23)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* **AggregationCursor:** adding session tracking to AggregationCursor ([baca5b7](https://github.com/mongodb/node-mongodb-native/commit/baca5b7))
|
|
31
|
+
* **Collection:** fix session leak in parallelCollectonScan ([3331ec9](https://github.com/mongodb/node-mongodb-native/commit/3331ec9))
|
|
32
|
+
* **comments:** adding fixes for PR comments ([ee110ac](https://github.com/mongodb/node-mongodb-native/commit/ee110ac))
|
|
33
|
+
* **url_parser:** support a default database on mongodb+srv uris ([6d39b2a](https://github.com/mongodb/node-mongodb-native/commit/6d39b2a))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Features
|
|
37
|
+
|
|
38
|
+
* **sessions:** adding implicit cursor session support ([a81245b](https://github.com/mongodb/node-mongodb-native/commit/a81245b))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
<a name="3.0.4"></a>
|
|
43
|
+
## [3.0.4](https://github.com/mongodb/node-mongodb-native/compare/v3.0.2...v3.0.4) (2018-03-05)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Bug Fixes
|
|
47
|
+
|
|
48
|
+
* **collection:** fix error when calling remove with no args ([#1657](https://github.com/mongodb/node-mongodb-native/issues/1657)) ([4c9b0f8](https://github.com/mongodb/node-mongodb-native/commit/4c9b0f8))
|
|
49
|
+
* **executeOperation:** don't mutate options passed to commands ([934a43a](https://github.com/mongodb/node-mongodb-native/commit/934a43a))
|
|
50
|
+
* **jsdoc:** mark db.collection callback as optional + typo fix ([#1658](https://github.com/mongodb/node-mongodb-native/issues/1658)) ([c519b9b](https://github.com/mongodb/node-mongodb-native/commit/c519b9b))
|
|
51
|
+
* **sessions:** move active session tracking to topology base ([#1665](https://github.com/mongodb/node-mongodb-native/issues/1665)) ([b1f296f](https://github.com/mongodb/node-mongodb-native/commit/b1f296f))
|
|
52
|
+
* **utils:** fixes executeOperation to clean up sessions ([04e6ef6](https://github.com/mongodb/node-mongodb-native/commit/04e6ef6))
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
### Features
|
|
56
|
+
|
|
57
|
+
* **default-db:** use dbName from uri if none provided ([23b1938](https://github.com/mongodb/node-mongodb-native/commit/23b1938))
|
|
58
|
+
* **mongodb-core:** update to mongodb-core 3.0.4 ([1fdbaa5](https://github.com/mongodb/node-mongodb-native/commit/1fdbaa5))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
1
62
|
<a name="3.0.3"></a>
|
|
2
63
|
## [3.0.3](https://github.com/mongodb/node-mongodb-native/compare/v3.0.2...v3.0.3) (2018-02-23)
|
|
3
64
|
|
package/conf.json
CHANGED
package/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
// Core module
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const core = require('mongodb-core');
|
|
5
|
+
const Instrumentation = require('./lib/apm');
|
|
6
6
|
|
|
7
7
|
// Set up the connect function
|
|
8
|
-
|
|
8
|
+
const connect = require('./lib/mongo_client').connect;
|
|
9
9
|
|
|
10
10
|
// Expose error class
|
|
11
11
|
connect.MongoError = core.MongoError;
|
|
@@ -55,7 +55,9 @@ connect.instrument = function(options, callback) {
|
|
|
55
55
|
options = {};
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
const instrumentation = new Instrumentation();
|
|
59
|
+
instrumentation.instrument(connect.MongoClient, callback);
|
|
60
|
+
return instrumentation;
|
|
59
61
|
};
|
|
60
62
|
|
|
61
63
|
// Set our exports to be the connect function
|
package/lib/admin.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
const toError = require('./utils').toError;
|
|
4
|
+
const shallowClone = require('./utils').shallowClone;
|
|
5
|
+
const executeOperation = require('./utils').executeOperation;
|
|
6
|
+
const applyWriteConcern = require('./utils').applyWriteConcern;
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @fileOverview The **Admin** class is an internal class that allows convenient access to
|
|
@@ -48,8 +48,6 @@ var Admin = function(db, topology, promiseLibrary) {
|
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
var define = (Admin.define = new Define('Admin', Admin, false));
|
|
52
|
-
|
|
53
51
|
/**
|
|
54
52
|
* The callback format for results
|
|
55
53
|
* @callback Admin~resultCallback
|
|
@@ -79,8 +77,6 @@ Admin.prototype.command = function(command, options, callback) {
|
|
|
79
77
|
]);
|
|
80
78
|
};
|
|
81
79
|
|
|
82
|
-
define.classMethod('command', { callback: true, promise: true });
|
|
83
|
-
|
|
84
80
|
/**
|
|
85
81
|
* Retrieve the server information for the current
|
|
86
82
|
* instance of the db client
|
|
@@ -102,8 +98,6 @@ Admin.prototype.buildInfo = function(options, callback) {
|
|
|
102
98
|
]);
|
|
103
99
|
};
|
|
104
100
|
|
|
105
|
-
define.classMethod('buildInfo', { callback: true, promise: true });
|
|
106
|
-
|
|
107
101
|
/**
|
|
108
102
|
* Retrieve the server information for the current
|
|
109
103
|
* instance of the db client
|
|
@@ -125,8 +119,6 @@ Admin.prototype.serverInfo = function(options, callback) {
|
|
|
125
119
|
]);
|
|
126
120
|
};
|
|
127
121
|
|
|
128
|
-
define.classMethod('serverInfo', { callback: true, promise: true });
|
|
129
|
-
|
|
130
122
|
/**
|
|
131
123
|
* Retrieve this db's server status.
|
|
132
124
|
*
|
|
@@ -153,8 +145,6 @@ var serverStatus = function(self, options, callback) {
|
|
|
153
145
|
});
|
|
154
146
|
};
|
|
155
147
|
|
|
156
|
-
define.classMethod('serverStatus', { callback: true, promise: true });
|
|
157
|
-
|
|
158
148
|
/**
|
|
159
149
|
* Ping the MongoDB server and retrieve results
|
|
160
150
|
*
|
|
@@ -175,29 +165,6 @@ Admin.prototype.ping = function(options, callback) {
|
|
|
175
165
|
]);
|
|
176
166
|
};
|
|
177
167
|
|
|
178
|
-
define.classMethod('ping', { callback: true, promise: true });
|
|
179
|
-
|
|
180
|
-
// Get write concern
|
|
181
|
-
var writeConcern = function(options, db) {
|
|
182
|
-
options = shallowClone(options);
|
|
183
|
-
|
|
184
|
-
// If options already contain write concerns return it
|
|
185
|
-
if (options.w || options.wtimeout || options.j || options.fsync) {
|
|
186
|
-
return options;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// Set db write concern if available
|
|
190
|
-
if (db.writeConcern) {
|
|
191
|
-
if (options.w) options.w = db.writeConcern.w;
|
|
192
|
-
if (options.wtimeout) options.wtimeout = db.writeConcern.wtimeout;
|
|
193
|
-
if (options.j) options.j = db.writeConcern.j;
|
|
194
|
-
if (options.fsync) options.fsync = db.writeConcern.fsync;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// Return modified options
|
|
198
|
-
return options;
|
|
199
|
-
};
|
|
200
|
-
|
|
201
168
|
/**
|
|
202
169
|
* Add a user to the database.
|
|
203
170
|
* @method
|
|
@@ -222,7 +189,7 @@ Admin.prototype.addUser = function(username, password, options, callback) {
|
|
|
222
189
|
options = args.length ? args.shift() : {};
|
|
223
190
|
options = options || {};
|
|
224
191
|
// Get the options
|
|
225
|
-
options =
|
|
192
|
+
options = applyWriteConcern(shallowClone(options), { db: self.s.db });
|
|
226
193
|
// Set the db name to admin
|
|
227
194
|
options.dbName = 'admin';
|
|
228
195
|
|
|
@@ -234,8 +201,6 @@ Admin.prototype.addUser = function(username, password, options, callback) {
|
|
|
234
201
|
]);
|
|
235
202
|
};
|
|
236
203
|
|
|
237
|
-
define.classMethod('addUser', { callback: true, promise: true });
|
|
238
|
-
|
|
239
204
|
/**
|
|
240
205
|
* Remove a user from a database
|
|
241
206
|
* @method
|
|
@@ -257,7 +222,7 @@ Admin.prototype.removeUser = function(username, options, callback) {
|
|
|
257
222
|
options = args.length ? args.shift() : {};
|
|
258
223
|
options = options || {};
|
|
259
224
|
// Get the options
|
|
260
|
-
options =
|
|
225
|
+
options = applyWriteConcern(shallowClone(options), { db: self.s.db });
|
|
261
226
|
// Set the db name
|
|
262
227
|
options.dbName = 'admin';
|
|
263
228
|
|
|
@@ -268,8 +233,6 @@ Admin.prototype.removeUser = function(username, options, callback) {
|
|
|
268
233
|
]);
|
|
269
234
|
};
|
|
270
235
|
|
|
271
|
-
define.classMethod('removeUser', { callback: true, promise: true });
|
|
272
|
-
|
|
273
236
|
/**
|
|
274
237
|
* Validate an existing collection
|
|
275
238
|
*
|
|
@@ -317,8 +280,6 @@ var validateCollection = function(self, collectionName, options, callback) {
|
|
|
317
280
|
});
|
|
318
281
|
};
|
|
319
282
|
|
|
320
|
-
define.classMethod('validateCollection', { callback: true, promise: true });
|
|
321
|
-
|
|
322
283
|
/**
|
|
323
284
|
* List the available databases
|
|
324
285
|
*
|
|
@@ -341,8 +302,6 @@ Admin.prototype.listDatabases = function(options, callback) {
|
|
|
341
302
|
]);
|
|
342
303
|
};
|
|
343
304
|
|
|
344
|
-
define.classMethod('listDatabases', { callback: true, promise: true });
|
|
345
|
-
|
|
346
305
|
/**
|
|
347
306
|
* Get ReplicaSet status
|
|
348
307
|
*
|
|
@@ -366,6 +325,4 @@ var replSetGetStatus = function(self, options, callback) {
|
|
|
366
325
|
});
|
|
367
326
|
};
|
|
368
327
|
|
|
369
|
-
define.classMethod('replSetGetStatus', { callback: true, promise: true });
|
|
370
|
-
|
|
371
328
|
module.exports = Admin;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
CoreCursor = require('./cursor');
|
|
3
|
+
const inherits = require('util').inherits;
|
|
4
|
+
const MongoError = require('mongodb-core').MongoError;
|
|
5
|
+
const Readable = require('stream').Readable;
|
|
6
|
+
const CoreCursor = require('./cursor');
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* @fileOverview The **AggregationCursor** class is an internal class that embodies an aggregation cursor on MongoDB
|
|
@@ -89,7 +88,9 @@ var AggregationCursor = function(bson, ns, cmd, options, topology, topologyOptio
|
|
|
89
88
|
// Topology Options
|
|
90
89
|
topologyOptions: topologyOptions,
|
|
91
90
|
// Promise library
|
|
92
|
-
promiseLibrary: promiseLibrary
|
|
91
|
+
promiseLibrary: promiseLibrary,
|
|
92
|
+
// Optional ClientSession
|
|
93
|
+
session: options.session
|
|
93
94
|
};
|
|
94
95
|
};
|
|
95
96
|
|
|
@@ -129,8 +130,6 @@ for (var name in CoreCursor.prototype) {
|
|
|
129
130
|
AggregationCursor.prototype[name] = CoreCursor.prototype[name];
|
|
130
131
|
}
|
|
131
132
|
|
|
132
|
-
var define = (AggregationCursor.define = new Define('AggregationCursor', AggregationCursor, true));
|
|
133
|
-
|
|
134
133
|
/**
|
|
135
134
|
* Set the batch size for the cursor.
|
|
136
135
|
* @method
|
|
@@ -148,8 +147,6 @@ AggregationCursor.prototype.batchSize = function(value) {
|
|
|
148
147
|
return this;
|
|
149
148
|
};
|
|
150
149
|
|
|
151
|
-
define.classMethod('batchSize', { callback: false, promise: false, returns: [AggregationCursor] });
|
|
152
|
-
|
|
153
150
|
/**
|
|
154
151
|
* Add a geoNear stage to the aggregation pipeline
|
|
155
152
|
* @method
|
|
@@ -161,8 +158,6 @@ AggregationCursor.prototype.geoNear = function(document) {
|
|
|
161
158
|
return this;
|
|
162
159
|
};
|
|
163
160
|
|
|
164
|
-
define.classMethod('geoNear', { callback: false, promise: false, returns: [AggregationCursor] });
|
|
165
|
-
|
|
166
161
|
/**
|
|
167
162
|
* Add a group stage to the aggregation pipeline
|
|
168
163
|
* @method
|
|
@@ -174,8 +169,6 @@ AggregationCursor.prototype.group = function(document) {
|
|
|
174
169
|
return this;
|
|
175
170
|
};
|
|
176
171
|
|
|
177
|
-
define.classMethod('group', { callback: false, promise: false, returns: [AggregationCursor] });
|
|
178
|
-
|
|
179
172
|
/**
|
|
180
173
|
* Add a limit stage to the aggregation pipeline
|
|
181
174
|
* @method
|
|
@@ -187,8 +180,6 @@ AggregationCursor.prototype.limit = function(value) {
|
|
|
187
180
|
return this;
|
|
188
181
|
};
|
|
189
182
|
|
|
190
|
-
define.classMethod('limit', { callback: false, promise: false, returns: [AggregationCursor] });
|
|
191
|
-
|
|
192
183
|
/**
|
|
193
184
|
* Add a match stage to the aggregation pipeline
|
|
194
185
|
* @method
|
|
@@ -200,8 +191,6 @@ AggregationCursor.prototype.match = function(document) {
|
|
|
200
191
|
return this;
|
|
201
192
|
};
|
|
202
193
|
|
|
203
|
-
define.classMethod('match', { callback: false, promise: false, returns: [AggregationCursor] });
|
|
204
|
-
|
|
205
194
|
/**
|
|
206
195
|
* Add a maxTimeMS stage to the aggregation pipeline
|
|
207
196
|
* @method
|
|
@@ -215,8 +204,6 @@ AggregationCursor.prototype.maxTimeMS = function(value) {
|
|
|
215
204
|
return this;
|
|
216
205
|
};
|
|
217
206
|
|
|
218
|
-
define.classMethod('maxTimeMS', { callback: false, promise: false, returns: [AggregationCursor] });
|
|
219
|
-
|
|
220
207
|
/**
|
|
221
208
|
* Add a out stage to the aggregation pipeline
|
|
222
209
|
* @method
|
|
@@ -228,8 +215,6 @@ AggregationCursor.prototype.out = function(destination) {
|
|
|
228
215
|
return this;
|
|
229
216
|
};
|
|
230
217
|
|
|
231
|
-
define.classMethod('out', { callback: false, promise: false, returns: [AggregationCursor] });
|
|
232
|
-
|
|
233
218
|
/**
|
|
234
219
|
* Add a project stage to the aggregation pipeline
|
|
235
220
|
* @method
|
|
@@ -241,8 +226,6 @@ AggregationCursor.prototype.project = function(document) {
|
|
|
241
226
|
return this;
|
|
242
227
|
};
|
|
243
228
|
|
|
244
|
-
define.classMethod('project', { callback: false, promise: false, returns: [AggregationCursor] });
|
|
245
|
-
|
|
246
229
|
/**
|
|
247
230
|
* Add a lookup stage to the aggregation pipeline
|
|
248
231
|
* @method
|
|
@@ -254,8 +237,6 @@ AggregationCursor.prototype.lookup = function(document) {
|
|
|
254
237
|
return this;
|
|
255
238
|
};
|
|
256
239
|
|
|
257
|
-
define.classMethod('lookup', { callback: false, promise: false, returns: [AggregationCursor] });
|
|
258
|
-
|
|
259
240
|
/**
|
|
260
241
|
* Add a redact stage to the aggregation pipeline
|
|
261
242
|
* @method
|
|
@@ -267,8 +248,6 @@ AggregationCursor.prototype.redact = function(document) {
|
|
|
267
248
|
return this;
|
|
268
249
|
};
|
|
269
250
|
|
|
270
|
-
define.classMethod('redact', { callback: false, promise: false, returns: [AggregationCursor] });
|
|
271
|
-
|
|
272
251
|
/**
|
|
273
252
|
* Add a skip stage to the aggregation pipeline
|
|
274
253
|
* @method
|
|
@@ -280,8 +259,6 @@ AggregationCursor.prototype.skip = function(value) {
|
|
|
280
259
|
return this;
|
|
281
260
|
};
|
|
282
261
|
|
|
283
|
-
define.classMethod('skip', { callback: false, promise: false, returns: [AggregationCursor] });
|
|
284
|
-
|
|
285
262
|
/**
|
|
286
263
|
* Add a sort stage to the aggregation pipeline
|
|
287
264
|
* @method
|
|
@@ -293,8 +270,6 @@ AggregationCursor.prototype.sort = function(document) {
|
|
|
293
270
|
return this;
|
|
294
271
|
};
|
|
295
272
|
|
|
296
|
-
define.classMethod('sort', { callback: false, promise: false, returns: [AggregationCursor] });
|
|
297
|
-
|
|
298
273
|
/**
|
|
299
274
|
* Add a unwind stage to the aggregation pipeline
|
|
300
275
|
* @method
|
|
@@ -306,22 +281,8 @@ AggregationCursor.prototype.unwind = function(field) {
|
|
|
306
281
|
return this;
|
|
307
282
|
};
|
|
308
283
|
|
|
309
|
-
define.classMethod('unwind', { callback: false, promise: false, returns: [AggregationCursor] });
|
|
310
|
-
|
|
311
284
|
AggregationCursor.prototype.get = AggregationCursor.prototype.toArray;
|
|
312
285
|
|
|
313
|
-
// Inherited methods
|
|
314
|
-
define.classMethod('toArray', { callback: true, promise: true });
|
|
315
|
-
define.classMethod('each', { callback: true, promise: false });
|
|
316
|
-
define.classMethod('forEach', { callback: true, promise: false });
|
|
317
|
-
define.classMethod('hasNext', { callback: true, promise: true });
|
|
318
|
-
define.classMethod('next', { callback: true, promise: true });
|
|
319
|
-
define.classMethod('close', { callback: true, promise: true });
|
|
320
|
-
define.classMethod('isClosed', { callback: false, promise: false, returns: [Boolean] });
|
|
321
|
-
define.classMethod('rewind', { callback: false, promise: false });
|
|
322
|
-
define.classMethod('bufferedCount', { callback: false, promise: false, returns: [Number] });
|
|
323
|
-
define.classMethod('readBufferedDocuments', { callback: false, promise: false, returns: [Array] });
|
|
324
|
-
|
|
325
286
|
/**
|
|
326
287
|
* Get the next available document from the cursor, returns null if no more documents are available.
|
|
327
288
|
* @function AggregationCursor.prototype.next
|