diff --git a/source/core/index-sparse.txt b/source/core/index-sparse.txt index eb95cf2343a..d48f8bdee5c 100644 --- a/source/core/index-sparse.txt +++ b/source/core/index-sparse.txt @@ -125,7 +125,7 @@ The collection has a sparse index on the field ``score``: .. code-block:: javascript - db.scores.createIndex( { score: 1 } , { sparse: true } ) + db.scores.createIndex( { score: 1 } , { sparse: true } ) Then, the following query on the ``scores`` collection uses the sparse index to return the documents that have the ``score`` field less than @@ -160,7 +160,7 @@ The collection has a sparse index on the field ``score``: .. code-block:: javascript - db.scores.createIndex( { score: 1 } , { sparse: true } ) + db.scores.createIndex( { score: 1 } , { sparse: true } ) Because the document for the userid ``"newbie"`` does not contain the ``score`` field, the sparse index does not contain an entry for that @@ -217,7 +217,7 @@ the following operation: .. code-block:: javascript - db.scores.createIndex( { score: 1 } , { sparse: true, unique: true } ) + db.scores.createIndex( { score: 1 } , { sparse: true, unique: true } ) This index *would permit* the insertion of documents that had unique values for the ``score`` field *or* did not include a ``score`` field. diff --git a/source/core/query-optimization.txt b/source/core/query-optimization.txt index b0dbee75eee..387e2617958 100644 --- a/source/core/query-optimization.txt +++ b/source/core/query-optimization.txt @@ -110,7 +110,7 @@ For example, a collection ``inventory`` has the following index on the .. code-block:: javascript - db.inventory.createIndex( { type: 1, item: 1 } ) + db.inventory.createIndex( { type: 1, item: 1 } ) This index will cover the following operation which queries on the ``type`` and ``item`` fields and returns only the ``item`` field: diff --git a/source/includes/example-push-each.rst b/source/includes/example-push-each.rst index 417f386a29d..9bc52578497 100644 --- a/source/includes/example-push-each.rst +++ b/source/includes/example-push-each.rst @@ -4,7 +4,7 @@ equals ``joe``: .. code-block:: javascript - db.students.update( - { name: "joe" }, - { $push: { scores: { $each: [ 90, 92, 85 ] } } } - ) + db.students.update( + { name: "joe" }, + { $push: { scores: { $each: [ 90, 92, 85 ] } } } + ) diff --git a/source/includes/output-upgrade-check.rst b/source/includes/output-upgrade-check.rst index 91f6441c02c..cf3b2fcc548 100644 --- a/source/includes/output-upgrade-check.rst +++ b/source/includes/output-upgrade-check.rst @@ -47,7 +47,7 @@ Warning Output .. code-block:: none - Warning: upgradeCheck only supports V1 indexes. Skipping index: + Warning: upgradeCheck only supports V1 indexes. Skipping index: To resolve, remove the invalid index and recreate the index omitting the version specification, or reindex the collection. Reindex operation diff --git a/source/reference/command/collStats.txt b/source/reference/command/collStats.txt index 65b54fa5c4e..7cf97105d37 100644 --- a/source/reference/command/collStats.txt +++ b/source/reference/command/collStats.txt @@ -123,7 +123,7 @@ The following operation runs the :dbcommand:`collStats` command on the .. code-block:: javascript - db.runCommand( { collStats : "restaurants", scale: 1024 } ) + db.runCommand( { collStats : "restaurants", scale: 1024 } ) The following document provides a representation of the :dbcommand:`collStats` output. Depending on the configuration of your diff --git a/source/reference/command/currentOp.txt b/source/reference/command/currentOp.txt index a60b008b094..55c89cb9d0e 100644 --- a/source/reference/command/currentOp.txt +++ b/source/reference/command/currentOp.txt @@ -165,14 +165,14 @@ database ``db1`` that have been running longer than 3 seconds: .. code-block:: javascript - db.adminCommand( - { - currentOp: true, - "active" : true, - "secs_running" : { "$gt" : 3 }, - "ns" : /^db1\./ - } - ) + db.adminCommand( + { + currentOp: true, + "active" : true, + "secs_running" : { "$gt" : 3 }, + "ns" : /^db1\./ + } + ) .. _currentOp-cmd-index-creation: diff --git a/source/reference/command/dataSize.txt b/source/reference/command/dataSize.txt index 4dece3b0c3f..eee67ed19a0 100644 --- a/source/reference/command/dataSize.txt +++ b/source/reference/command/dataSize.txt @@ -102,7 +102,7 @@ and the upper bound of the key to be examined being ``{field: 100}``. .. code-block:: javascript - db.runCommand({ dataSize: "database.collection", keyPattern: { field: 1 }, min: { field: 10 }, max: { field: 100 } }) + db.runCommand({ dataSize: "database.collection", keyPattern: { field: 1 }, min: { field: 10 }, max: { field: 100 } }) This will return a document that contains the size of all matching documents. Replace ``database.collection`` value with database diff --git a/source/reference/command/findAndModify.txt b/source/reference/command/findAndModify.txt index 7456b18361d..9aedd169aca 100644 --- a/source/reference/command/findAndModify.txt +++ b/source/reference/command/findAndModify.txt @@ -460,11 +460,11 @@ following form: .. code-block:: javascript - db.people.findAndModify( { - query: { name: "Tom", state: "active", rating: { $gt: 10 } }, - sort: { rating: 1 }, - update: { $inc: { score: 1 } } - } ); + db.people.findAndModify( { + query: { name: "Tom", state: "active", rating: { $gt: 10 } }, + sort: { rating: 1 }, + update: { $inc: { score: 1 } } + } ); However, the :method:`~db.collection.findAndModify()` shell helper method returns only the unmodified document, or if ``new`` is @@ -489,15 +489,15 @@ document or, if no matching document exists, create a new document: .. code-block:: javascript - db.runCommand( - { - findAndModify: "people", - query: { name: "Gus", state: "active", rating: 100 }, - sort: { rating: 1 }, - update: { $inc: { score: 1 } }, - upsert: true - } - ) + db.runCommand( + { + findAndModify: "people", + query: { name: "Gus", state: "active", rating: 100 }, + sort: { rating: 1 }, + update: { $inc: { score: 1 } }, + upsert: true + } + ) If the command finds a matching document, the command performs an update. diff --git a/source/reference/command/removeShard.txt b/source/reference/command/removeShard.txt index a1886be2558..78d230b1376 100644 --- a/source/reference/command/removeShard.txt +++ b/source/reference/command/removeShard.txt @@ -25,7 +25,7 @@ against the ``admin`` database: .. code-block:: javascript - db.adminCommand( { removeShard : } ) + db.adminCommand( { removeShard : } ) Behavior -------- diff --git a/source/reference/command/usersInfo.txt b/source/reference/command/usersInfo.txt index beb9cbdbb50..8efeb439832 100644 --- a/source/reference/command/usersInfo.txt +++ b/source/reference/command/usersInfo.txt @@ -236,7 +236,7 @@ that resembles the following: .. code-block:: javascript - db.runCommand( { usersInfo: 1 } ) + db.runCommand( { usersInfo: 1 } ) When viewing all users, you can specify the ``showCredentials`` option but not the ``showPrivileges`` or the diff --git a/source/reference/command/validate.txt b/source/reference/command/validate.txt index bf31ed0cde7..80c007f255e 100644 --- a/source/reference/command/validate.txt +++ b/source/reference/command/validate.txt @@ -104,7 +104,7 @@ Examples .. code-block:: javascript - db.runCommand( { validate: "myCollection", full: true } ) + db.runCommand( { validate: "myCollection", full: true } ) .. _validate-output: diff --git a/source/reference/installation-ubuntu-community-troubleshooting.txt b/source/reference/installation-ubuntu-community-troubleshooting.txt index 67d2df010bc..46b3f8dad06 100644 --- a/source/reference/installation-ubuntu-community-troubleshooting.txt +++ b/source/reference/installation-ubuntu-community-troubleshooting.txt @@ -79,7 +79,7 @@ by running the following command in the terminal: .. code-block:: text - sudo apt-key list + sudo apt-key list The output should include an entry that resembles the following: diff --git a/source/reference/method/db.collection.bulkWrite.txt b/source/reference/method/db.collection.bulkWrite.txt index bb87392bc2f..8522cffcebf 100644 --- a/source/reference/method/db.collection.bulkWrite.txt +++ b/source/reference/method/db.collection.bulkWrite.txt @@ -400,16 +400,16 @@ five operations. .. code-block:: javascript - db.collection.bulkWrite( - [ - { insertOne : }, - { updateOne : }, - { updateMany : }, - { replaceOne : }, - { deleteOne : }, - { deleteMany : } - ] - ) + db.collection.bulkWrite( + [ + { insertOne : }, + { updateOne : }, + { updateMany : }, + { replaceOne : }, + { deleteOne : }, + { deleteMany : } + ] + ) In the default ``ordered : true`` state, each operation will be executed in order, from the first operation ``insertOne`` @@ -424,17 +424,17 @@ The following code represents an unordered .. code-block:: javascript - db.collection.bulkWrite( - [ - { insertOne : }, - { updateOne : }, - { updateMany : }, - { replaceOne : }, - { deleteOne : }, - { deleteMany : } - ], - { ordered : false } - ) + db.collection.bulkWrite( + [ + { insertOne : }, + { updateOne : }, + { updateMany : }, + { replaceOne : }, + { deleteOne : }, + { deleteMany : } + ], + { ordered : false } + ) With ``ordered : false``, the results of the operation may vary. For example, the ``deleteOne`` or ``deleteMany`` may remove more or fewer documents diff --git a/source/reference/method/db.currentOp.txt b/source/reference/method/db.currentOp.txt index 8c4cab63559..54caadb3e13 100644 --- a/source/reference/method/db.currentOp.txt +++ b/source/reference/method/db.currentOp.txt @@ -202,13 +202,13 @@ database ``db1`` that have been running longer than 3 seconds: .. code-block:: javascript - db.currentOp( - { - "active" : true, - "secs_running" : { "$gt" : 3 }, - "ns" : /^db1\./ - } - ) + db.currentOp( + { + "active" : true, + "secs_running" : { "$gt" : 3 }, + "ns" : /^db1\./ + } + ) .. _currentOp-index-creation: diff --git a/source/reference/method/isInteractive.txt b/source/reference/method/isInteractive.txt index 671fe52bad7..d70adb7bf9d 100644 --- a/source/reference/method/isInteractive.txt +++ b/source/reference/method/isInteractive.txt @@ -59,7 +59,7 @@ Running a Javascript File inside the ``mongo`` Shell .. code-block:: javascript - let loadStatus = load("testExample.js"); //You may need to specify the path to the file + let loadStatus = load("testExample.js"); //You may need to specify the path to the file The method returns in the :binary:`~bin.mongo` shell: diff --git a/source/reference/operator/aggregation/dateFromString.txt b/source/reference/operator/aggregation/dateFromString.txt index 4a8d1a27aa3..c72226dce17 100644 --- a/source/reference/operator/aggregation/dateFromString.txt +++ b/source/reference/operator/aggregation/dateFromString.txt @@ -207,16 +207,16 @@ to a date object: .. code-block:: javascript - db.logmessages.aggregate( [ { - $project: { - date: { - $dateFromString: { - dateString: '$date', - timezone: 'America/New_York' - } - } - } - } ] ) + db.logmessages.aggregate( [ { + $project: { + date: { + $dateFromString: { + dateString: '$date', + timezone: 'America/New_York' + } + } + } + } ] ) The above aggregation returns the following documents and converts each ``date`` field to the Eastern Time Zone: @@ -234,16 +234,16 @@ hard coded argument. For example: .. code-block:: javascript - db.logmessages.aggregate( [ { - $project: { - date: { - $dateFromString: { - dateString: '$date', - timezone: '$timezone' - } - } - } - } ] ) + db.logmessages.aggregate( [ { + $project: { + date: { + $dateFromString: { + dateString: '$date', + timezone: '$timezone' + } + } + } + } ] ) The above aggregation returns the following documents and converts each ``date`` field to their respective UTC representations. diff --git a/source/reference/operator/aggregation/match.txt b/source/reference/operator/aggregation/match.txt index 067f4c8bc88..864027b1574 100644 --- a/source/reference/operator/aggregation/match.txt +++ b/source/reference/operator/aggregation/match.txt @@ -126,10 +126,10 @@ the documents: .. code-block:: javascript - db.articles.aggregate( [ - { $match: { $or: [ { score: { $gt: 70, $lt: 90 } }, { views: { $gte: 1000 } } ] } }, - { $group: { _id: null, count: { $sum: 1 } } } - ] ); + db.articles.aggregate( [ + { $match: { $or: [ { score: { $gt: 70, $lt: 90 } }, { views: { $gte: 1000 } } ] } }, + { $group: { _id: null, count: { $sum: 1 } } } + ] ); In the aggregation pipeline, :pipeline:`$match` selects the documents where either the ``score`` is greater than ``70`` and less than ``90`` diff --git a/source/reference/operator/aggregation/range.txt b/source/reference/operator/aggregation/range.txt index 7ed3eb25553..95388e24ea4 100644 --- a/source/reference/operator/aggregation/range.txt +++ b/source/reference/operator/aggregation/range.txt @@ -104,13 +104,13 @@ the stopping points for each trip. .. code-block:: javascript - db.distances.aggregate([{ - $project: { - _id: 0, - city: 1, - "Rest stops": { $range: [ 0, "$distance", 25 ] } - } - }]) + db.distances.aggregate([{ + $project: { + _id: 0, + city: 1, + "Rest stops": { $range: [ 0, "$distance", 25 ] } + } + }]) The operation returns the following: diff --git a/source/reference/operator/aggregation/redact.txt b/source/reference/operator/aggregation/redact.txt index 6961177e1fe..7f978bb7c31 100644 --- a/source/reference/operator/aggregation/redact.txt +++ b/source/reference/operator/aggregation/redact.txt @@ -200,20 +200,20 @@ fields contained in a document/embedded document at level ``5``, include a .. code-block:: javascript - db.accounts.aggregate( - [ - { $match: { status: "A" } }, - { - $redact: { - $cond: { - if: { $eq: [ "$level", 5 ] }, - then: "$$PRUNE", - else: "$$DESCEND" - } - } - } - ] - ); + db.accounts.aggregate( + [ + { $match: { status: "A" } }, + { + $redact: { + $cond: { + if: { $eq: [ "$level", 5 ] }, + then: "$$PRUNE", + else: "$$DESCEND" + } + } + } + ] + ); The :pipeline:`$redact` stage evaluates the ``level`` field to determine access. If the ``level`` field equals ``5``, then exclude all diff --git a/source/reference/operator/aggregation/reduce.txt b/source/reference/operator/aggregation/reduce.txt index 44b32009d7b..38afb105389 100644 --- a/source/reference/operator/aggregation/reduce.txt +++ b/source/reference/operator/aggregation/reduce.txt @@ -273,36 +273,36 @@ The following example reduces the ``hobbies`` array of strings into a single str .. code-block:: javascript - db.people.aggregate( - [ - // Filter to return only non-empty arrays - { $match: { "hobbies": { $gt: [ ] } } }, - { - $project: { - "name": 1, - "bio": { - $reduce: { - input: "$hobbies", - initialValue: "My hobbies include:", - in: { - $concat: [ - "$$value", - { - $cond: { - if: { $eq: [ "$$value", "My hobbies include:" ] }, - then: " ", - else: ", " - } - }, - "$$this" - ] - } - } - } - } - } - ] - ) + db.people.aggregate( + [ + // Filter to return only non-empty arrays + { $match: { "hobbies": { $gt: [ ] } } }, + { + $project: { + "name": 1, + "bio": { + $reduce: { + input: "$hobbies", + initialValue: "My hobbies include:", + in: { + $concat: [ + "$$value", + { + $cond: { + if: { $eq: [ "$$value", "My hobbies include:" ] }, + then: " ", + else: ", " + } + }, + "$$this" + ] + } + } + } + } + } + ] + ) The operation returns the following: diff --git a/source/reference/operator/aggregation/regexFind.txt b/source/reference/operator/aggregation/regexFind.txt index 74b64851b2d..ba811c6c018 100644 --- a/source/reference/operator/aggregation/regexFind.txt +++ b/source/reference/operator/aggregation/regexFind.txt @@ -535,12 +535,12 @@ Create a sample collection ``feedback`` with the following documents: .. code-block:: javascript - db.feedback.insertMany([ - { "_id" : 1, comment: "Hi, I'm just reading about MongoDB -- aunt.arc.tica@example.com" }, - { "_id" : 2, comment: "I wanted to concatenate a string" }, - { "_id" : 3, comment: "How do I convert a date to string? cam@mongodb.com" }, - { "_id" : 4, comment: "It's just me. I'm testing. fred@MongoDB.com" } - ]) + db.feedback.insertMany([ + { "_id" : 1, comment: "Hi, I'm just reading about MongoDB -- aunt.arc.tica@example.com" }, + { "_id" : 2, comment: "I wanted to concatenate a string" }, + { "_id" : 3, comment: "How do I convert a date to string? cam@mongodb.com" }, + { "_id" : 4, comment: "It's just me. I'm testing. fred@MongoDB.com" } + ]) The following aggregation uses the :expression:`$regexFind` to extract the email from the ``comment`` field (case insensitive). @@ -600,16 +600,16 @@ the ``details`` array into an embedded document with an ``email`` and .. code-block:: javascript - db.contacts.aggregate( [ - { $unwind: "$details" }, - { $addFields: { - "regexemail": { $regexFind: { input: "$details", regex: /^[a-z0-9_.+-]+@[a-z0-9_.+-]+\.[a-z0-9_.+-]+$/, options: "i" } }, - "regexphone": { $regexFind: { input: "$details", regex: /^[+]{0,1}[0-9]*\-?[0-9_\-]+$/ } } - } }, - { $project: { _id: 1, name: 1, details: { email: "$regexemail.match", phone: "$regexphone.match" } } }, - { $group: { _id: "$_id", name: { $first: "$name" }, details: { $mergeObjects: "$details"} } }, - { $sort: { _id: 1 } } - ]) + db.contacts.aggregate( [ + { $unwind: "$details" }, + { $addFields: { + "regexemail": { $regexFind: { input: "$details", regex: /^[a-z0-9_.+-]+@[a-z0-9_.+-]+\.[a-z0-9_.+-]+$/, options: "i" } }, + "regexphone": { $regexFind: { input: "$details", regex: /^[+]{0,1}[0-9]*\-?[0-9_\-]+$/ } } + } }, + { $project: { _id: 1, name: 1, details: { email: "$regexemail.match", phone: "$regexphone.match" } } }, + { $group: { _id: "$_id", name: { $first: "$name" }, details: { $mergeObjects: "$details"} } }, + { $sort: { _id: 1 } } + ]) First Stage The stage :pipeline:`$unwinds` the array into separate documents: diff --git a/source/reference/operator/aggregation/subtract.txt b/source/reference/operator/aggregation/subtract.txt index ba280a21d72..a53d1ca6b56 100644 --- a/source/reference/operator/aggregation/subtract.txt +++ b/source/reference/operator/aggregation/subtract.txt @@ -54,7 +54,7 @@ subtotal of ``price`` and ``fee``. .. code-block:: javascript - db.sales.aggregate( [ { $project: { item: 1, total: { $subtract: [ { $add: [ "$price", "$fee" ] }, "$discount" ] } } } ] ) + db.sales.aggregate( [ { $project: { item: 1, total: { $subtract: [ { $add: [ "$price", "$fee" ] }, "$discount" ] } } } ] ) The operation returns the following results: @@ -73,13 +73,13 @@ milliseconds: .. code-block:: javascript - db.sales.aggregate( [ { $project: { item: 1, dateDifference: { $subtract: [ "$$NOW", "$date" ] } } } ] ) + db.sales.aggregate( [ { $project: { item: 1, dateDifference: { $subtract: [ "$$NOW", "$date" ] } } } ] ) Alternatively, you can use the :method:`Date()` for the current date:s .. code-block:: javascript - db.sales.aggregate( [ { $project: { item: 1, dateDifference: { $subtract: [ new Date(), "$date" ] } } } ] ) + db.sales.aggregate( [ { $project: { item: 1, dateDifference: { $subtract: [ new Date(), "$date" ] } } } ] ) Both operations return documents that resemble the following: @@ -97,7 +97,7 @@ field: .. code-block:: javascript - db.sales.aggregate( [ { $project: { item: 1, dateDifference: { $subtract: [ "$date", 5 * 60 * 1000 ] } } } ] ) + db.sales.aggregate( [ { $project: { item: 1, dateDifference: { $subtract: [ "$date", 5 * 60 * 1000 ] } } } ] ) The operation returns the following results: diff --git a/source/reference/operator/aggregation/unset.txt b/source/reference/operator/aggregation/unset.txt index 4852f1da780..4d0aa091f27 100644 --- a/source/reference/operator/aggregation/unset.txt +++ b/source/reference/operator/aggregation/unset.txt @@ -137,9 +137,9 @@ embedded field ``first`` (from the ``name`` document) and the embedded field .. code-block:: javascript - db.books.aggregate([ - { $unset: [ "isbn", "author.first", "copies.warehouse" ] } - ]) + db.books.aggregate([ + { $unset: [ "isbn", "author.first", "copies.warehouse" ] } + ]) The :pipeline:`$unset` operation outputs the following documents: diff --git a/source/reference/operator/query/bitsAnySet.txt b/source/reference/operator/query/bitsAnySet.txt index ee661853977..a85169fe6b7 100644 --- a/source/reference/operator/query/bitsAnySet.txt +++ b/source/reference/operator/query/bitsAnySet.txt @@ -70,7 +70,7 @@ whether field ``a`` has any bits set at positions ``0``, ``1``, and ``5`` .. code-block:: javascript - db.collection.find( { a: { $bitsAnySet: 35 } } ) + db.collection.find( { a: { $bitsAnySet: 35 } } ) The query matches the following documents: diff --git a/source/reference/operator/query/jsonSchema.txt b/source/reference/operator/query/jsonSchema.txt index 3aa9cc49c4d..7dbca4a9dfa 100644 --- a/source/reference/operator/query/jsonSchema.txt +++ b/source/reference/operator/query/jsonSchema.txt @@ -278,8 +278,8 @@ collection that satisfy the schema: .. code-block:: javascript - db.inventory.find( { $jsonSchema: myschema } ) - db.inventory.aggregate( [ { $match: { $jsonSchema: myschema } } ] ) + db.inventory.find( { $jsonSchema: myschema } ) + db.inventory.aggregate( [ { $match: { $jsonSchema: myschema } } ] ) You can use :query:`$jsonSchema` with the :query:`$nor` to find all documents that do not satisfy the schema: diff --git a/source/reference/operator/update/mul.txt b/source/reference/operator/update/mul.txt index a0c087b06a9..0a0d157fd32 100644 --- a/source/reference/operator/update/mul.txt +++ b/source/reference/operator/update/mul.txt @@ -128,10 +128,10 @@ that does not exist in the document: .. code-block:: javascript - db.products.update( - { _id: 2 }, - { $mul: { price: NumberLong(100) } } - ) + db.products.update( + { _id: 2 }, + { $mul: { price: NumberLong(100) } } + ) The operation results in the following document with a ``price`` field set to value 0 of numeric type :ref:`shell-type-long`, the same type as @@ -157,10 +157,10 @@ The following :method:`db.collection.update()` operation uses the .. code-block:: javascript - db.products.update( - { _id: 3 }, - { $mul: { price: NumberInt(5) } } - ) + db.products.update( + { _id: 3 }, + { $mul: { price: NumberInt(5) } } + ) The operation results in the following document: diff --git a/source/reference/operator/update/positional-all.txt b/source/reference/operator/update/positional-all.txt index e48ee8224df..74a54286673 100644 --- a/source/reference/operator/update/positional-all.txt +++ b/source/reference/operator/update/positional-all.txt @@ -59,11 +59,11 @@ array field: .. code-block:: javascript - db.collection.update( - { myArray: [ 5, 8 ] }, - { $set: { "myArray.$[]": 10 } }, - { upsert: true } - ) + db.collection.update( + { myArray: [ 5, 8 ] }, + { $set: { "myArray.$[]": 10 } }, + { upsert: true } + ) If no such document exists, the operation would result in an insertion of the following document: @@ -81,17 +81,17 @@ documents were found to update: .. code-block:: javascript - db.collection.update( - { myArray: 5 }, - { $set: { "myArray.$[]": 10 } }, - { upsert: true } - ) - - db.collection.update( - { }, - { $set: { "myArray.$[]": 10 } }, - { upsert: true } - ) + db.collection.update( + { myArray: 5 }, + { $set: { "myArray.$[]": 10 } }, + { upsert: true } + ) + + db.collection.update( + { }, + { $set: { "myArray.$[]": 10 } }, + { upsert: true } + ) Nested Arrays ~~~~~~~~~~~~~ diff --git a/source/release-notes/3.4-compatibility.txt b/source/release-notes/3.4-compatibility.txt index 9d9eaa1feb8..dd8dad81dd0 100644 --- a/source/release-notes/3.4-compatibility.txt +++ b/source/release-notes/3.4-compatibility.txt @@ -305,10 +305,10 @@ is successful because of this behavior: .. code-block:: javascript - db.c.drop() - db.c.update( { a : { $in : [1] } }, { $addToSet : { a : 2 } }, { upsert : true } ) - db.c.find() - { "_id" : ObjectId("58bdb00eb39e8f87607e9222"), "a" : [ 2 ] } + db.c.drop() + db.c.update( { a : { $in : [1] } }, { $addToSet : { a : 2 } }, { upsert : true } ) + db.c.find() + { "_id" : ObjectId("58bdb00eb39e8f87607e9222"), "a" : [ 2 ] } In 3.4 and newer versions, however, a single-element :query:`$in` behaves like an equality statement for upserts. If the query includes this condition diff --git a/source/release-notes/4.0-upgrade-replica-set.txt b/source/release-notes/4.0-upgrade-replica-set.txt index c909b48eb4d..3a60a11403f 100644 --- a/source/release-notes/4.0-upgrade-replica-set.txt +++ b/source/release-notes/4.0-upgrade-replica-set.txt @@ -138,7 +138,7 @@ replica set member and check the ``featureCompatibilityVersion``: .. code-block:: javascript - db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } ) + db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } ) All members should return a result that includes ``"featureCompatibilityVersion" : { "version" : "3.6" }``. @@ -151,7 +151,7 @@ members must be available: .. code-block:: javascript - db.adminCommand( { setFeatureCompatibilityVersion: "3.6" } ) + db.adminCommand( { setFeatureCompatibilityVersion: "3.6" } ) For more information, see :dbcommand:`setFeatureCompatibilityVersion`. diff --git a/source/release-notes/4.2-upgrade-replica-set.txt b/source/release-notes/4.2-upgrade-replica-set.txt index cab233cff2c..7bf1efd0804 100644 --- a/source/release-notes/4.2-upgrade-replica-set.txt +++ b/source/release-notes/4.2-upgrade-replica-set.txt @@ -103,7 +103,7 @@ replica set member and check the ``featureCompatibilityVersion``: .. code-block:: javascript - db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } ) + db.adminCommand( { getParameter: 1, featureCompatibilityVersion: 1 } ) All members should return a result that includes ``"featureCompatibilityVersion" : { "version" : "4.0" }``. @@ -116,7 +116,7 @@ members must be available: .. code-block:: javascript - db.adminCommand( { setFeatureCompatibilityVersion: "4.0" } ) + db.adminCommand( { setFeatureCompatibilityVersion: "4.0" } ) For more information, see :dbcommand:`setFeatureCompatibilityVersion`. diff --git a/source/tutorial/configure-mongo-shell.txt b/source/tutorial/configure-mongo-shell.txt index 011af8b5e91..fb15a7a9448 100644 --- a/source/tutorial/configure-mongo-shell.txt +++ b/source/tutorial/configure-mongo-shell.txt @@ -55,11 +55,11 @@ To create a :binary:`~bin.mongo` shell prompt in the form of .. code-block:: javascript - host = db.serverStatus().host; + host = db.serverStatus().host; - prompt = function() { - return db+"@"+host+"$ "; - } + prompt = function() { + return db+"@"+host+"$ "; + } The prompt would then resemble the following: @@ -85,7 +85,7 @@ The prompt would then resemble the following: .. code-block:: javascript - Uptime:5897 Documents:6 > + Uptime:5897 Documents:6 > Use an External Editor in the ``mongo`` Shell --------------------------------------------- diff --git a/source/tutorial/deploy-sharded-cluster-with-keyfile-access-control.txt b/source/tutorial/deploy-sharded-cluster-with-keyfile-access-control.txt index dc1cb00f906..e44deabd8c0 100644 --- a/source/tutorial/deploy-sharded-cluster-with-keyfile-access-control.txt +++ b/source/tutorial/deploy-sharded-cluster-with-keyfile-access-control.txt @@ -104,8 +104,8 @@ Create the Keyfile .. code-block:: shell - openssl rand -base64 756 > - chmod 400 + openssl rand -base64 756 > + chmod 400 See :ref:`internal-auth-keyfile` for additional details and requirements for using keyfiles. diff --git a/source/tutorial/enforce-keyfile-access-control-in-existing-sharded-cluster-no-downtime.txt b/source/tutorial/enforce-keyfile-access-control-in-existing-sharded-cluster-no-downtime.txt index e827536605d..39a9aa92d16 100644 --- a/source/tutorial/enforce-keyfile-access-control-in-existing-sharded-cluster-no-downtime.txt +++ b/source/tutorial/enforce-keyfile-access-control-in-existing-sharded-cluster-no-downtime.txt @@ -103,8 +103,8 @@ Create and Distribute the Keyfile .. code-block:: shell - openssl rand -base64 755 > - chmod 400 + openssl rand -base64 755 > + chmod 400 .. include:: /includes/extracts/keyfile-distribution-sharded-cluster.rst @@ -164,17 +164,17 @@ roles: .. code-block:: javascript - admin = db.getSiblingDB("admin") - admin.createUser( - { - user: "admin", - pwd: passwordPrompt(), // or cleartext password - roles: [ - { role: "clusterAdmin", db: "admin" }, - { role: "userAdmin", db: "admin" } - ] - } - ) + admin = db.getSiblingDB("admin") + admin.createUser( + { + user: "admin", + pwd: passwordPrompt(), // or cleartext password + roles: [ + { role: "clusterAdmin", db: "admin" }, + { role: "userAdmin", db: "admin" } + ] + } + ) At the completion of this tutorial, if you want to connect to the shard to perform maintenance operation that require direct connection to a