Skip to content

Commit 08e800f

Browse files
authored
DOCS-14973 replace save() with insertOne() or replaceOne() as appropriate (#2392)
1 parent 66b1961 commit 08e800f

File tree

7 files changed

+16
-13
lines changed

7 files changed

+16
-13
lines changed

source/core/geospatial-indexes.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ Multi-location Documents for ``2d`` Indexes
6464
-------------------------------------------
6565

6666
.. note::
67+
6768
:ref:`2dsphere <2dsphere-index>` indexes can cover multiple geospatial fields
6869
in a document, and can express lists of points using
6970
:ref:`geojson-multipoint` embedded documents.
@@ -77,7 +78,7 @@ example:
7778

7879
.. code-block:: javascript
7980

80-
db.places.save( {
81+
db.places.insertOne( {
8182
locs : [ [ 55.5 , 42.3 ] ,
8283
[ -74 , 44.74 ] ,
8384
{ lng : 55.5 , lat : 42.3 } ]
@@ -101,7 +102,7 @@ coordinates. For example:
101102

102103
.. code-block:: javascript
103104

104-
db.records.save( {
105+
db.records.insertOne( {
105106
name : "John Smith",
106107
addresses : [ {
107108
context : "home" ,

source/includes/extracts-fact-query-bitwise.yaml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ content: |
139139
140140
.. code-block:: javascript
141141
142-
db.collection.save({ x: BinData(0, "ww=="), binaryValueofA: "11000011" })
142+
db.collection.insertOne({ x: BinData(0, "ww=="), binaryValueofA: "11000011" })
143143
144144
:query:`{{op}}` will consider all bits outside of ``x`` to be clear.
145145
---
@@ -177,10 +177,12 @@ content: |
177177
178178
.. code-block:: javascript
179179
180-
db.collection.save({ _id: 1, a: 54, binaryValueofA: "00110110" })
181-
db.collection.save({ _id: 2, a: 20, binaryValueofA: "00010100" })
182-
db.collection.save({ _id: 3, a: 20.0, binaryValueofA: "00010100" })
183-
db.collection.save({ _id: 4, a: BinData(0, "Zg=="), binaryValueofA: "01100110" })
180+
db.collection.insertMany([
181+
{ _id: 1, a: 54, binaryValueofA: "00110110" },
182+
{ _id: 2, a: 20, binaryValueofA: "00010100" },
183+
{ _id: 3, a: 20.0, binaryValueofA: "00010100" },
184+
{ _id: 4, a: BinData(0, "Zg=="), binaryValueofA: "01100110" }
185+
])
184186
---
185187
ref: _fact-query-bitwise-indexes
186188
content: |

source/reference/method/cursor.pretty.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Consider the following document:
4444

4545
.. code-block:: javascript
4646

47-
db.books.save({
47+
db.books.insertOne({
4848
"_id" : ObjectId("54f612b6029b47909a90ce8d"),
4949
"title" : "A Tale of Two Cities",
5050
"text" : "It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness...",

source/reference/operator/aggregation/zip.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ A collection called ``pages`` contains the following document:
194194

195195
.. code-block:: javascript
196196

197-
db.pages.save( {
197+
db.pages.insertOne( {
198198
"category": "unix",
199199
"pages": [
200200
{ "title": "awk for beginners", reviews: 5 },

source/tutorial/convert-shard-standalone-to-shard-replica-set.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ Procedure
101101

102102
.. code-block:: javascript
103103

104-
db.getSiblingDB("config").shards.save(myShard, { writeConcern: { w: "majority" } } )
104+
db.getSiblingDB("config").shards.replaceOne(myShard, { writeConcern: { w: "majority" } } )
105105

106106
#. Repeat for the next standalone shard in the sharded cluster. Ensure
107107
that you use a distinct name for each shard replica set.

source/tutorial/model-iot-data.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ current client's offset from UTC.
151151
.. code-block:: javascript
152152

153153
var now = new Date();
154-
db.data.save( { date: now,
154+
db.data.insertOne( { date: now,
155155
offset: now.getTimezoneOffset() } );
156156

157157
You can reconstruct the original local time by applying the saved

source/tutorial/model-monetary-data.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ new ``priceDec`` field in the :pipeline:`$addFields` stage:
171171
}
172172
]
173173
).forEach( ( function( doc ) {
174-
db.clothes.save( doc );
174+
db.clothes.replaceOne( doc );
175175
} ) )
176176

177177
The results of the aggregation pipeline can be verified using the
@@ -231,7 +231,7 @@ value and stores it in the ``priceDec`` field:
231231

232232
db.clothes.find( { $and : [ { price: { $exists: true } }, { price: { $type: "string" } } ] } ).forEach( function( doc ) {
233233
doc.priceDec = NumberDecimal( doc.price );
234-
db.clothes.save( doc );
234+
db.clothes.replaceOne( doc );
235235
} );
236236

237237
The function does not output anything to the command line. The results

0 commit comments

Comments
 (0)