summaryrefslogtreecommitdiff
path: root/src/mongo/shell/query.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/shell/query.js')
-rw-r--r--src/mongo/shell/query.js84
1 files changed, 41 insertions, 43 deletions
diff --git a/src/mongo/shell/query.js b/src/mongo/shell/query.js
index 7bd167b5437..bd451166e9d 100644
--- a/src/mongo/shell/query.js
+++ b/src/mongo/shell/query.js
@@ -2,7 +2,6 @@
if (typeof DBQuery == "undefined") {
DBQuery = function(mongo, db, collection, ns, query, fields, limit, skip, batchSize, options) {
-
this._mongo = mongo; // 0
this._db = db; // 1
this._collection = collection; // 2
@@ -399,8 +398,8 @@ DBQuery.prototype.countReturn = function() {
};
/**
-* iterative count - only for testing
-*/
+ * iterative count - only for testing
+ */
DBQuery.prototype.itcount = function() {
var num = 0;
@@ -555,7 +554,6 @@ DBQuery.prototype.shellPrint = function() {
} catch (e) {
print(e);
}
-
};
DBQuery.prototype.toString = function() {
@@ -567,12 +565,12 @@ DBQuery.prototype.toString = function() {
//
/**
-* Get partial results from a mongos if some shards are down (instead of throwing an error).
-*
-* @method
-* @see http://docs.mongodb.org/meta-driver/latest/legacy/mongodb-wire-protocol/#op-query
-* @return {DBQuery}
-*/
+ * Get partial results from a mongos if some shards are down (instead of throwing an error).
+ *
+ * @method
+ * @see http://docs.mongodb.org/meta-driver/latest/legacy/mongodb-wire-protocol/#op-query
+ * @return {DBQuery}
+ */
DBQuery.prototype.allowPartialResults = function() {
this._checkModify();
this.addOption(DBQuery.Option.partial);
@@ -580,13 +578,13 @@ DBQuery.prototype.allowPartialResults = function() {
};
/**
-* The server normally times out idle cursors after an inactivity period (10 minutes)
-* to prevent excess memory use. Set this option to prevent that.
-*
-* @method
-* @see http://docs.mongodb.org/meta-driver/latest/legacy/mongodb-wire-protocol/#op-query
-* @return {DBQuery}
-*/
+ * The server normally times out idle cursors after an inactivity period (10 minutes)
+ * to prevent excess memory use. Set this option to prevent that.
+ *
+ * @method
+ * @see http://docs.mongodb.org/meta-driver/latest/legacy/mongodb-wire-protocol/#op-query
+ * @return {DBQuery}
+ */
DBQuery.prototype.noCursorTimeout = function() {
this._checkModify();
this.addOption(DBQuery.Option.noTimeout);
@@ -594,13 +592,13 @@ DBQuery.prototype.noCursorTimeout = function() {
};
/**
-* Limits the fields to return for all matching documents.
-*
-* @method
-* @see http://docs.mongodb.org/manual/tutorial/project-fields-from-query-results/
-* @param {object} document Document specifying the projection of the resulting documents.
-* @return {DBQuery}
-*/
+ * Limits the fields to return for all matching documents.
+ *
+ * @method
+ * @see http://docs.mongodb.org/manual/tutorial/project-fields-from-query-results/
+ * @param {object} document Document specifying the projection of the resulting documents.
+ * @return {DBQuery}
+ */
DBQuery.prototype.projection = function(document) {
this._checkModify();
this._fields = document;
@@ -608,14 +606,14 @@ DBQuery.prototype.projection = function(document) {
};
/**
-* Specify cursor as a tailable cursor, allowing to specify if it will use awaitData
-*
-* @method
-* @see http://docs.mongodb.org/manual/tutorial/create-tailable-cursor/
-* @param {boolean} [awaitData=true] cursor blocks for a few seconds to wait for data if no documents
-*found.
-* @return {DBQuery}
-*/
+ * Specify cursor as a tailable cursor, allowing to specify if it will use awaitData
+ *
+ * @method
+ * @see http://docs.mongodb.org/manual/tutorial/create-tailable-cursor/
+ * @param {boolean} [awaitData=true] cursor blocks for a few seconds to wait for data if no
+ *documents found.
+ * @return {DBQuery}
+ */
DBQuery.prototype.tailable = function(awaitData) {
this._checkModify();
this.addOption(DBQuery.Option.tailable);
@@ -629,13 +627,13 @@ DBQuery.prototype.tailable = function(awaitData) {
};
/**
-* Specify a document containing modifiers for the query.
-*
-* @method
-* @see http://docs.mongodb.org/manual/reference/operator/query-modifier/
-* @param {object} document A document containing modifers to apply to the cursor.
-* @return {DBQuery}
-*/
+ * Specify a document containing modifiers for the query.
+ *
+ * @method
+ * @see http://docs.mongodb.org/manual/reference/operator/query-modifier/
+ * @param {object} document A document containing modifers to apply to the cursor.
+ * @return {DBQuery}
+ */
DBQuery.prototype.modifiers = function(document) {
this._checkModify();
@@ -802,16 +800,16 @@ DBCommandCursor.prototype._runGetMoreCommand = function() {
assert.commandWorked(cmdRes, () => "getMore command failed: " + tojson(cmdRes));
if (this._ns !== cmdRes.cursor.ns) {
- throw Error("unexpected collection in getMore response: " + this._ns + " != " +
- cmdRes.cursor.ns);
+ throw Error("unexpected collection in getMore response: " + this._ns +
+ " != " + cmdRes.cursor.ns);
}
if (!cmdRes.cursor.id.compare(NumberLong("0"))) {
this._cursorHandle.zeroCursorId();
this._cursorid = NumberLong("0");
} else if (this._cursorid.compare(cmdRes.cursor.id)) {
- throw Error("unexpected cursor id: " + this._cursorid.toString() + " != " +
- cmdRes.cursor.id.toString());
+ throw Error("unexpected cursor id: " + this._cursorid.toString() +
+ " != " + cmdRes.cursor.id.toString());
}
// If the command result represents a change stream cursor, update our postBatchResumeToken.