mongodb 3.5.3 → 3.5.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/HISTORY.md +60 -0
- package/README.md +1 -1
- package/lib/change_stream.js +12 -13
- package/lib/cmap/connection_pool.js +1 -1
- package/lib/collection.js +1 -1
- package/lib/core/cursor.js +0 -9
- package/lib/core/sdam/server.js +4 -2
- package/lib/core/sdam/server_selection.js +4 -0
- package/lib/core/sdam/topology.js +37 -31
- package/lib/core/sdam/topology_description.js +27 -5
- package/lib/core/sessions.js +18 -8
- package/lib/core/topologies/shared.js +9 -2
- package/lib/core/uri_parser.js +3 -3
- package/lib/core/utils.js +4 -1
- package/lib/cursor.js +88 -19
- package/lib/mongo_client.js +62 -19
- package/lib/operations/connect.js +1 -26
- package/lib/operations/count.js +0 -4
- package/lib/operations/cursor_ops.js +1 -72
- package/lib/operations/db_ops.js +0 -361
- package/lib/operations/execute_operation.js +2 -6
- package/lib/operations/find.js +1 -2
- package/lib/operations/operation.js +1 -3
- package/lib/operations/remove_user.js +1 -1
- package/lib/utils.js +43 -1
- package/package.json +5 -5
- package/lib/operations/close.js +0 -50
- package/lib/operations/explain.js +0 -23
- package/lib/operations/has_next.js +0 -40
- package/lib/operations/next.js +0 -32
- package/lib/operations/to_array.js +0 -66
package/lib/operations/next.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const Aspect = require('./operation').Aspect;
|
|
4
|
-
const defineAspects = require('./operation').defineAspects;
|
|
5
|
-
const OperationBase = require('./operation').OperationBase;
|
|
6
|
-
const nextObject = require('./common_functions').nextObject;
|
|
7
|
-
|
|
8
|
-
class NextOperation extends OperationBase {
|
|
9
|
-
constructor(cursor) {
|
|
10
|
-
super();
|
|
11
|
-
|
|
12
|
-
this.cursor = cursor;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
execute(callback) {
|
|
16
|
-
const cursor = this.cursor;
|
|
17
|
-
|
|
18
|
-
// Return the currentDoc if someone called hasNext first
|
|
19
|
-
if (cursor.s.currentDoc) {
|
|
20
|
-
const doc = cursor.s.currentDoc;
|
|
21
|
-
cursor.s.currentDoc = null;
|
|
22
|
-
return callback(null, doc);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Return the next object
|
|
26
|
-
nextObject(cursor, callback);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
defineAspects(NextOperation, Aspect.SKIP_SESSION);
|
|
31
|
-
|
|
32
|
-
module.exports = NextOperation;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const Aspect = require('./operation').Aspect;
|
|
4
|
-
const defineAspects = require('./operation').defineAspects;
|
|
5
|
-
const handleCallback = require('../utils').handleCallback;
|
|
6
|
-
const CursorState = require('../core/cursor').CursorState;
|
|
7
|
-
const OperationBase = require('./operation').OperationBase;
|
|
8
|
-
const push = Array.prototype.push;
|
|
9
|
-
|
|
10
|
-
class ToArrayOperation extends OperationBase {
|
|
11
|
-
constructor(cursor) {
|
|
12
|
-
super();
|
|
13
|
-
|
|
14
|
-
this.cursor = cursor;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
execute(callback) {
|
|
18
|
-
const cursor = this.cursor;
|
|
19
|
-
const items = [];
|
|
20
|
-
|
|
21
|
-
// Reset cursor
|
|
22
|
-
cursor.rewind();
|
|
23
|
-
cursor.s.state = CursorState.INIT;
|
|
24
|
-
|
|
25
|
-
// Fetch all the documents
|
|
26
|
-
const fetchDocs = () => {
|
|
27
|
-
cursor._next((err, doc) => {
|
|
28
|
-
if (err) {
|
|
29
|
-
return cursor._endSession
|
|
30
|
-
? cursor._endSession(() => handleCallback(callback, err))
|
|
31
|
-
: handleCallback(callback, err);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
if (doc == null) {
|
|
35
|
-
return cursor.close({ skipKillCursors: true }, () =>
|
|
36
|
-
handleCallback(callback, null, items)
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Add doc to items
|
|
41
|
-
items.push(doc);
|
|
42
|
-
|
|
43
|
-
// Get all buffered objects
|
|
44
|
-
if (cursor.bufferedCount() > 0) {
|
|
45
|
-
let docs = cursor.readBufferedDocuments(cursor.bufferedCount());
|
|
46
|
-
|
|
47
|
-
// Transform the doc if transform method added
|
|
48
|
-
if (cursor.s.transforms && typeof cursor.s.transforms.doc === 'function') {
|
|
49
|
-
docs = docs.map(cursor.s.transforms.doc);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
push.apply(items, docs);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// Attempt a fetch
|
|
56
|
-
fetchDocs();
|
|
57
|
-
});
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
fetchDocs();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
defineAspects(ToArrayOperation, Aspect.SKIP_SESSION);
|
|
65
|
-
|
|
66
|
-
module.exports = ToArrayOperation;
|