@@ -13,54 +13,61 @@ msgstr ""
13
13
14
14
#: ../source/tutorial/insert-documents.txt:3
15
15
msgid "Insert Documents"
16
- msgstr ""
16
+ msgstr "插入文档 "
17
17
18
18
#: ../source/tutorial/insert-documents.txt:7
19
19
msgid ""
20
20
"In MongoDB, the :method:`db.collection.insert()` method adds new documents "
21
21
"into a collection."
22
22
msgstr ""
23
+ "在MongoDB中,我们使用 :method:`db.collection.insert()` 方法向集合里面添加新文档。"
23
24
24
25
#: ../source/tutorial/insert-documents.txt:11
25
26
msgid "Insert a Document"
26
- msgstr ""
27
+ msgstr "插入一个文档 "
27
28
28
29
#: ../source/includes/steps/getting-started-insert.rst:8
29
30
msgid "Insert a document into a collection."
30
- msgstr ""
31
+ msgstr "插入一个文档到集合中。 "
31
32
32
33
#: ../source/includes/steps/getting-started-insert.rst:11
33
34
msgid ""
34
35
"Insert a document into a collection named ``inventory``. The operation will "
35
36
"create the collection if the collection does not currently exist."
36
37
msgstr ""
38
+ "以下示例向名为``inventory``的集合中插入一个文档。若该集合不存在,此方法将创建该集合。"
37
39
38
40
#: ../source/includes/steps/getting-started-insert.rst:31
39
41
msgid ""
40
42
"The operation returns a :method:`WriteResult` object with the status of the "
41
43
"operation. A successful insert of the document returns the following object:"
42
44
msgstr ""
45
+ "此操作返回一个带有操作状态的 :method:`WriteResult` 对象。"
46
+ "文档插入成功将返回如下对象:"
43
47
44
48
#: ../source/includes/steps/getting-started-insert.rst:41
45
49
msgid ""
46
50
"The :data:`~WriteResult.nInserted` field specifies the number of documents "
47
51
"inserted. If the operation encounters an error, the :method:`WriteResult` "
48
52
"object will contain the error information."
49
53
msgstr ""
54
+ ":data:`~WriteResult.nInserted` 字段指定了插入文档的个数。如果操作过程中遭遇错误,"
55
+ ":method:`WriteResult` 对象将包含错误信息。"
50
56
51
57
#: ../source/includes/steps/getting-started-insert.rst:57
52
58
msgid "Review the inserted document."
53
- msgstr ""
59
+ msgstr "查看插入的文档。 "
54
60
55
61
#: ../source/includes/steps/getting-started-insert.rst:60
56
62
msgid ""
57
63
"If the insert operation is successful, verify the insertion by querying the "
58
64
"collection."
59
65
msgstr ""
66
+ "如果插入操作成功,通过查询该集合验证插入结果。"
60
67
61
68
#: ../source/includes/steps/getting-started-insert.rst:69
62
69
msgid "The document you inserted should return."
63
- msgstr ""
70
+ msgstr "将返回你插入的文档。 "
64
71
65
72
#: ../source/includes/steps/getting-started-insert.rst:77
66
73
msgid ""
@@ -70,36 +77,42 @@ msgid ""
70
77
":manual:`ObjectId </reference/object-id>`. The :manual:`ObjectId </reference"
71
78
"/object-id>` values in your documents will differ from the ones shown."
72
79
msgstr ""
80
+ "在返回文档中可以看到,MongoDB 向文档中添加了一个 ``_id`` 字段。"
81
+ "如果客户端插入文档不包含 ``_id`` 字段,MongoDB服务器将自动添加该字段并设置其值为 :manual:`ObjectId </reference/object-id>`。"
82
+ "你的文档中的 :manual:`ObjectId </reference/object-id>` 值会和以上显示的不同。"
73
83
74
84
#: ../source/tutorial/insert-documents.txt:16
75
85
msgid "Insert an Array of Documents"
76
- msgstr ""
86
+ msgstr "插入文档数组 "
77
87
78
88
#: ../source/tutorial/insert-documents.txt:18
79
89
msgid ""
80
90
"You can pass an array of documents to the :method:`db.collection.insert()` "
81
91
"method to insert multiple documents."
82
92
msgstr ""
93
+ "你可以通过传递文档数组到方法 :method:`db.collection.insert()` 的方式插入多个文档。"
83
94
84
95
#: ../source/includes/steps/getting-started-insert-an-array.rst:8
85
96
msgid "Create an array of documents."
86
- msgstr ""
97
+ msgstr "创建文档数组。 "
87
98
88
99
#: ../source/includes/steps/getting-started-insert-an-array.rst:11
89
100
msgid ""
90
101
"Define a variable ``mydocuments`` that holds an array of documents to "
91
102
"insert."
92
103
msgstr ""
104
+ "定义变量 ``mydocuments`` 用于保存待插入的文档数组。"
93
105
94
106
#: ../source/includes/steps/getting-started-insert-an-array.rst:51
95
107
msgid "Insert the documents."
96
- msgstr ""
108
+ msgstr "插入所有文档。 "
97
109
98
110
#: ../source/includes/steps/getting-started-insert-an-array.rst:54
99
111
msgid ""
100
112
"Pass the ``mydocuments`` array to the :method:`db.collection.insert()` to "
101
113
"perform a bulk insert."
102
114
msgstr ""
115
+ "传递数组 ``mydocuments`` 到方法 :method:`db.collection.insert()` 执行批量插入。"
103
116
104
117
#: ../source/includes/steps/getting-started-insert-an-array.rst:63
105
118
#: ../source/includes/steps/getting-started-insert-bulk.rst:92
@@ -108,6 +121,8 @@ msgid ""
108
121
" operation. A successful insert of the documents returns the following "
109
122
"object:"
110
123
msgstr ""
124
+ "该方法返回包含操作状态的 :method:`BulkWriteResult` 对象。"
125
+ "若插入成功将返回如下对象:"
111
126
112
127
#: ../source/includes/steps/getting-started-insert-an-array.rst:82
113
128
#: ../source/includes/steps/getting-started-insert-bulk.rst:111
@@ -117,15 +132,18 @@ msgid ""
117
132
":method:`BulkWriteResult` object will contain information regarding the "
118
133
"error."
119
134
msgstr ""
135
+ ":data:`~BulkWriteResult.nInserted` 字段表示已插入文档数。如果操作中遇到错误,:method:`BulkWriteResult` "
136
+ "对象将包含错误的有关信息。"
120
137
121
138
#: ../source/includes/steps/getting-started-insert-an-array.rst:87
122
139
msgid ""
123
140
"The inserted documents will each have an ``_id`` field added by MongoDB."
124
141
msgstr ""
142
+ "每个插入的文档都将包含MongoDB自动添加的``_id``字段。"
125
143
126
144
#: ../source/tutorial/insert-documents.txt:24
127
145
msgid "Insert Multiple Documents with ``Bulk``"
128
- msgstr ""
146
+ msgstr "用``Bulk``插入多个文档 "
129
147
130
148
#: ../source/tutorial/insert-documents.txt:28
131
149
msgid ""
@@ -134,16 +152,19 @@ msgid ""
134
152
"how you would use the :method:`Bulk()` API to insert a group of documents "
135
153
"into a MongoDB collection."
136
154
msgstr ""
155
+ "MongoDB提供一个用于执行批量写入的 :method:`Bulk()` API。"
156
+ "以下操作步骤描述了如何使用 :method:`Bulk()` API向MongoDB集合中插入一组文档。"
137
157
138
158
#: ../source/includes/steps/getting-started-insert-bulk.rst:8
139
159
msgid "Initialize a ``Bulk`` operations builder."
140
- msgstr ""
160
+ msgstr "初始化一个操作构建器``Bulk``。 "
141
161
142
162
#: ../source/includes/steps/getting-started-insert-bulk.rst:11
143
163
msgid ""
144
164
"Initialize a :method:`Bulk` operations builder for the collection "
145
165
"``inventory``."
146
166
msgstr ""
167
+ "给集合``inventory``初始化一个操作构建器 :method:`Bulk` 。"
147
168
148
169
#: ../source/includes/steps/getting-started-insert-bulk.rst:20
149
170
msgid ""
@@ -153,40 +174,46 @@ msgid ""
153
174
" during the processing of one of the write operations, MongoDB will continue"
154
175
" to process remaining write operations in the list."
155
176
msgstr ""
177
+ "该操作返回一个无序的操作构建器,维护了所有待执行的操作列表。"
178
+ "无序操作意味着MongoDB能够以平行方式执行,也可以用非确定性顺序的方式执行列表中的操作。"
179
+ "如果当执行其中一个写操作时出现错误,MongoDB将继续执行列表中其他剩余的写操作。"
156
180
157
181
#: ../source/includes/steps/getting-started-insert-bulk.rst:27
158
182
msgid ""
159
183
"You can also initialize an ordered operations builder; see "
160
184
":method:`db.collection.initializeOrderedBulkOp()` for details."
161
185
msgstr ""
186
+ "你也可初始化一个有序的操作构建器; 详见 :method:`db.collection.initializeOrderedBulkOp()` 。"
162
187
163
188
#: ../source/includes/steps/getting-started-insert-bulk.rst:42
164
189
msgid "Add insert operations to the ``bulk`` object."
165
- msgstr ""
190
+ msgstr "向``bulk``对象中添加插入操作。 "
166
191
167
192
#: ../source/includes/steps/getting-started-insert-bulk.rst:45
168
193
msgid ""
169
194
"Add two insert operations to the ``bulk`` object using the "
170
195
":method:`Bulk.insert()` method."
171
196
msgstr ""
197
+ "使用 :method:`Bulk.insert()` 方法向``bulk``对象中添加两个插入操作。"
172
198
173
199
#: ../source/includes/steps/getting-started-insert-bulk.rst:80
174
200
msgid "Execute the bulk operation."
175
- msgstr ""
201
+ msgstr "执行批量操作。 "
176
202
177
203
#: ../source/includes/steps/getting-started-insert-bulk.rst:83
178
204
msgid ""
179
205
"Call the :method:`~Bulk.execute()` method on the ``bulk`` object to execute "
180
206
"the operations in its list."
181
207
msgstr ""
208
+ "调用``bulk``对象的:method:`~Bulk.execute()`方法以执行``bulk``对象列表中的所有操作。"
182
209
183
210
#: ../source/tutorial/insert-documents.txt:36
184
211
msgid "Additional Examples and Methods"
185
- msgstr ""
212
+ msgstr "更多的示例和方法 "
186
213
187
214
#: ../source/tutorial/insert-documents.txt:38
188
215
msgid "For more examples, see :method:`db.collection.insert()`."
189
- msgstr ""
216
+ msgstr "更多的示例请见 :method:`db.collection.insert()`。 "
190
217
191
218
#: ../source/tutorial/insert-documents.txt:40
192
219
msgid ""
@@ -196,3 +223,6 @@ msgid ""
196
223
"individual reference pages for the methods for more information and "
197
224
"examples."
198
225
msgstr ""
226
+ "使用:method:`db.collection.update()`方法、:method:`db.collection.findAndModify()`,以及"
227
+ "method:`db.collection.save()`方法也能新增文档。"
228
+ "可分别查看他们的页面获取更多的信息和示例。"
0 commit comments