-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
find.js
33 lines (25 loc) · 838 Bytes
/
find.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'use strict';
const OperationBase = require('./operation').OperationBase;
const Aspect = require('./operation').Aspect;
const defineAspects = require('./operation').defineAspects;
class FindOperation extends OperationBase {
constructor(collection, ns, command, options) {
super(options);
this.ns = ns;
this.cmd = command;
}
execute(server, callback) {
// copied from `CommandOperationV2`, to be subclassed in the future
this.server = server;
const cursorState = this.cursorState || {};
// TOOD: use `MongoDBNamespace` through and through
server.query(this.ns.toString(), this.cmd, cursorState, this.options, callback);
}
}
defineAspects(FindOperation, [
Aspect.READ_OPERATION,
Aspect.RETRYABLE,
Aspect.EXECUTE_WITH_SELECTION,
Aspect.SKIP_SESSION
]);
module.exports = FindOperation;