Skip to content

Commit ea9d1ac

Browse files
committed
Getting Started updates for new node methods
1 parent d8a5134 commit ea9d1ac

14 files changed

+86
-34
lines changed

primer/config/primer-migrations-complex.yaml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ transform:
3737
- regex: ":doc:`(.*) <(/reference/configuration-options)>`"
3838
replace: ":manual:`\\1 <\\2>`"
3939
---
40-
source: includes/steps-configure-windows-service-for-mongodb.yaml
41-
transform:
42-
regex: ":doc:`(.*) <(/reference/configuration-options)>`"
43-
replace: ":manual:`\\1 <\\2>`"
44-
---
4540
source: includes/steps-create-manually-windows-service-for-mongodb.yaml
4641
transform:
4742
regex: ":doc:`(.*) <(/reference/configuration-options)>`"
@@ -52,6 +47,16 @@ transform:
5247
regex: ":doc:"
5348
replace: ":manual:"
5449
---
50+
source: includes/steps-get-mongodb-for-windows.yaml
51+
transform:
52+
regex: ":doc:"
53+
replace: ":manual:"
54+
---
55+
source: includes/steps-install-mongodb-on-windows-unattended.yaml
56+
transform:
57+
regex: ":doc:"
58+
replace: ":manual:"
59+
---
5560
source: includes/fact-selinux-redhat-options.rst
5661
transform:
5762
regex: ":doc:"

primer/config/primer-migrations-simple.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
override: false
22
sources:
3-
- includes/table-linux-kernel-version-production.yaml
43
- includes/fact-installation-bind-ip-default-in-config.rst
5-
- includes/note-minimum-glibc.rst
64
- includes/release-base.yaml
75
- includes/release-pinning.yaml
86
- includes/release-specifications.yaml
@@ -35,5 +33,5 @@ sources:
3533
- includes/driver-table.rst
3634
- includes/fact-installation-directories.rst
3735
- includes/note-package-change.rst
38-
- includes/fact-windows-unattended.rst
36+
- includes/note-suse-ulimit.rst
3937
...

primer/source/includes/examples-insert.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ operation:
153153
Inserted a document into the restaurants collection.
154154
replacement:
155155
insertMethod: |
156-
`insert <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#insert>`_
156+
`insertOne <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#insertOne>`_
157157
---
158158
source:
159159
file: examples-insert-base.yaml

primer/source/includes/examples-remove.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,13 @@ post: |
157157
The operation prints to the console the number of documents removed.
158158
replacement:
159159
removeMethod: |
160-
`remove() <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#remove>`_
160+
`deleteMany() <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#deleteMany>`_
161161
---
162162
source:
163163
file: examples-remove-base.yaml
164164
ref: _remove-justOne
165165
ref: remove-justOne
166-
title: "Use the ``single`` Option"
166+
title: "Remove just one document."
167167
edition: node
168168
operation:
169169
- pre: |
@@ -194,7 +194,7 @@ post: |
194194
The operation prints to the console the number of documents removed.
195195
replacement:
196196
removeMethod: |
197-
`remove() <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#remove>`_
197+
`deleteOne() <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#deleteOne>`_
198198
---
199199
source:
200200
file: examples-remove-base.yaml
@@ -207,7 +207,7 @@ operation:
207207
language: javascript
208208
code: |
209209
var removeRestaurants = function(db, callback) {
210-
db.collection('restaurants').removeMany( {}, function(err, results) {
210+
db.collection('restaurants').deleteMany( {}, function(err, results) {
211211
console.log(results);
212212
callback();
213213
});
@@ -227,7 +227,7 @@ post: |
227227
The operation prints to the console the number of documents removed.
228228
replacement:
229229
removeMethod: |
230-
`remove() <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#remove>`_
230+
`deleteMany() <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#deleteMany>`_
231231
---
232232
source:
233233
file: examples-remove-base.yaml

primer/source/includes/examples-update-fields.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ post: |
165165
The {{updateMethod}} returns the number of documents updated.
166166
replacement:
167167
updateMethod: |
168-
`update() <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#update>`_
168+
`updateOne() <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#updateOne>`_
169169
---
170170
source:
171171
file: examples-update-fields-base.yaml
@@ -201,13 +201,21 @@ post: |
201201
The {{updateMethod}} returns the number of documents updated.
202202
replacement:
203203
updateMethod: |
204-
`update() <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#update>`_
204+
`updateOne() <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#updateOne>`_
205205
---
206206
source:
207207
file: examples-update-fields-base.yaml
208208
ref: _update-multiple-documents
209209
ref: update-multiple-documents
210210
edition: node
211+
pre: |
212+
pre: |
213+
To update multiple documents, use the {{updateMethod}} method.
214+
215+
The following operation updates *all* documents that have
216+
``address.zipcode`` field equal to ``"10016"``, setting the ``borough``
217+
field to ``"Midtown"`` and the ``lastModified`` field to the current
218+
date.
211219
operation:
212220
- pre: |
213221
Define an ``updateRestaurants`` function as follows:
@@ -240,7 +248,7 @@ post: |
240248
The {{updateMethod}} returns the number of documents updated.
241249
replacement:
242250
updateMethod: |
243-
`update() <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#update>`_
251+
`updateMany() <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#updateMany>`_
244252
---
245253
source:
246254
file: examples-update-fields-base.yaml

primer/source/includes/examples-update-replace.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ post: |
9999
The {{updateMethod}} returns the number of documents updated.
100100
replacement:
101101
updateMethod: |
102-
`update() <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#update>`_
102+
`replaceOne() <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#replaceOne>`_
103103
---
104104
source:
105105
file: examples-update-replace-base.yaml

primer/source/includes/extracts-insert-overview.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ edition: shell
88
---
99
ref: insert-overview
1010
replacement:
11-
insert: :py:meth:`~pymongo.collection.Collection.insert()`
11+
insert: :py:meth:`~pymongo.collection.Collection.insertOne()` and the :py:meth:`~pymongo.collection.Collection.insertMany()`
1212
inherit:
1313
ref: _insert-overview
1414
file: extracts-insert-overview-base.yaml
1515
edition: python
1616
---
1717
ref: insert-overview
1818
replacement:
19-
insert: "`insert <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#insert>`_"
19+
insert: "`insertOne <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#insertOne>`_ method and the `insertMany <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#insert>`_"
2020
inherit:
2121
ref: _insert-overview
2222
file: extracts-insert-overview-base.yaml

primer/source/includes/extracts-remove-overview.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ edition: python
1616
---
1717
ref: remove-overview
1818
replacement:
19-
remove: "`remove <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#remove>`_"
19+
remove: "`deleteOne <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#deleteOne>`_ method and the `deleteMany <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#deleteMany>`_"
2020
inherit:
2121
ref: _remove-overview
2222
file: extracts-remove-overview-base.yaml

primer/source/includes/extracts-update-overview.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ edition: python
1616
---
1717
ref: update-overview
1818
replacement:
19-
update: "`update <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#update>`_"
19+
update: "`updateOne <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#updateOne>`_ method, `updateMany <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#updateMany>`_ method, and `replaceOne <http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#replaceOne>`_"
2020
inherit:
2121
ref: _update-overview
2222
file: extracts-update-overview-base.yaml
2323
edition: node
24+
post: |
25+
You cannot update the ``_id`` field.
2426
---
2527
ref: update-overview
2628
replacement:
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ref: _update-replace-overview
2+
content: |
3+
To replace the **entire** document except for the ``_id`` field, pass
4+
an entirely new document as the second argument to the
5+
{{update}} method. The replacement document can have
6+
different fields from the original document. In the replacement
7+
document, you can omit the ``_id`` field since the ``_id`` field is
8+
immutable. If you do include the ``_id`` field, it must be the same
9+
value as the existing value.
10+
post: |
11+
.. important::
12+
After the update, the document **only** contains the field or
13+
fields in the replacement document.
14+
15+
...

0 commit comments

Comments
 (0)