@@ -20,7 +20,7 @@ msgstr ""
2020# f14076a40ed7482fbcf10ab9a9628c1a
2121#: ../source/core/data-model-operations.txt:3
2222msgid "Operational Factors and Data Models"
23- msgstr ""
23+ msgstr "MongoDB特性和数据模型的关系 "
2424
2525# dd06504f1172476486ca2536f4c9a763
2626#: ../source/core/data-model-operations.txt:7
@@ -31,6 +31,9 @@ msgid ""
3131"throughput of insert and update operations, or distribute activity to a "
3232"sharded cluster more effectively."
3333msgstr ""
34+ "MongoDB的数据建模不仅仅取决于应用程序的数据需求,也需要考虑到MongoDB本身的一些特性。"
35+ "例如,有些数据模型可以让查询更加有效,有些可以增加插入或更新的并发量,有些则可以更有效"
36+ "地把事务均衡到各个分片服务器上。"
3437
3538# 39804f49724b483285f1e71c983485f9
3639#: ../source/core/data-model-operations.txt:13
@@ -41,11 +44,16 @@ msgid ""
4144"operations </core/read-operations>` and :doc:`write operations </core/write-"
4245"operations>` in conjunction with the following considerations."
4346msgstr ""
47+ "这些因素是和MongoDB的 *运行* 相关的,并不完全基于应用程序的需求,但是却对"
48+ "应用程序的性能会有直接的影响。当进行建模设计时,在分析应用程序所有的"
49+ " :doc:`读操作 </core/read-operations>` 和 :doc:`写操作 </core/write-"
50+ "operations>` 的前提下,你还需要考虑下述几个因素。"
51+
4452
4553# e513be50123b41798716e6159da8439e
4654#: ../source/core/data-model-operations.txt:23
4755msgid "Document Growth"
48- msgstr ""
56+ msgstr "文档增长性 "
4957
5058# 3afc6cb77214444cb8ff51245515af0d
5159#: ../source/core/data-model-operations.txt:35
@@ -54,6 +62,8 @@ msgid ""
5462"growth, you may want to refactor your data model to use references between "
5563"data in distinct documents rather than a denormalized data model."
5664msgstr ""
65+ "举例来说,如果你的程序的更新操作会导致文档大小增加,那么你可能要重新设计下数据模型,"
66+ "在不同文档之间使用引用的方式而非内嵌、冗余的数据结构。"
5767
5868# bbc7429c52734b0ca4fcd1d615026b03
5969#: ../source/core/data-model-operations.txt:40
@@ -64,18 +74,22 @@ msgid ""
6474"Reports Use Case </use-cases/pre-aggregated-reports>` for an example of the "
6575"*pre-allocation* approach to handling document growth."
6676msgstr ""
77+ "MongoDB会自动调整空白填充的大小以尽可能的减小文档迁移。你也可以使用一个"
78+ " *预分配* 策略来防止文档的增长。 具体关于使用 *预分配* 来处理文档增长的例子可以参见"
79+ " :ecosystem:`预聚合报表案例 </use-cases/pre-aggregated-reports>` "
6780
6881# e89a437e3d7f49b3becf1c5772c13ef2
6982#: ../source/core/data-model-operations.txt:47
7083msgid ""
7184"See :doc:`/core/storage` for more information on MongoDB's storage model and"
7285" record allocation strategies."
7386msgstr ""
87+ "关于MongoDB's 存储模式和记录分配策略的更多信息,请参见 :doc:`/core/storage`。"
7488
7589# 2fac3cab68ae4c80a566808c5d69584e
7690#: ../source/core/data-model-operations.txt:54
7791msgid "Atomicity"
78- msgstr ""
92+ msgstr "原子性 "
7993
8094# ae6124ad6f2c4f489bff1715a108f194
8195#: ../source/core/data-model-operations.txt:56
@@ -88,6 +102,11 @@ msgid ""
88102"If the application can tolerate non-atomic updates for two pieces of data, "
89103"you can store these data in separate documents."
90104msgstr ""
105+ "在MongoDB里面,所有操作在 :term:`document` 级别具有原子性. 一个 "
106+ "**单个** 写操作最多只可以修改一个文档。 即使是一个会改变同一个集合中多个文档的命令,"
107+ "在同一时间也只会操作一个文档。 [#record-atomicity]_ 尽可能保证那些需要在一个原子操作内"
108+ "进行修改的字段定义在同一个文档里面。如果你的应用程序允许对两个数据的非原子性更新操作,"
109+ "那么可以把这些数据定义在不同的文档内。"
91110
92111# 2b19e9a31c4c4b01b2be0fa42157f47c
93112#: ../source/core/data-model-operations.txt:65
@@ -97,13 +116,17 @@ msgid ""
97116"related pieces of data, the application must issue separate read and write "
98117"operations to retrieve and modify these related pieces of data."
99118msgstr ""
119+ "把相关数据定义到同一个文档里面的内嵌方式有利于这种原子性操作。对于那些使用引用来关联"
120+ "相关数据的数据模型,应用程序必须再用额外的读和写的操作去取回和修改相关的数据。"
121+
100122
101123# 4b1834b946674518b90eebd8e2e7f597
102124#: ../source/core/data-model-operations.txt:71
103125msgid ""
104126"See :ref:`data-modeling-atomic-operation` for an example data model that "
105127"provides atomic updates for a single document."
106128msgstr ""
129+ "关于原子性操作更新单个文档的例子,参见 :ref:`data-modeling-atomic-operation`。 "
107130
108131# 236516daec9e4edca6cae4f283ee9fbd
109132#: ../source/core/data-model-operations.txt:74
@@ -112,11 +135,13 @@ msgid ""
112135"MongoDB document record: operations that affect multiple sub-documents "
113136"within that single record are still atomic."
114137msgstr ""
138+ "文档级原子性操作包含所有针对于一个文档的操作: 即便是涉及到多个子文档的多个操作,只要是"
139+ "在同一个文档之内,这些操作仍旧是有原子性德。"
115140
116141# abf5cfa786244d6d93080d7c397c6e9d
117142#: ../source/core/data-model-operations.txt:80
118143msgid "Sharding"
119- msgstr ""
144+ msgstr "分片 "
120145
121146# 0f1c46264b894707a5c3a4a88b64987e
122147#: ../source/core/data-model-operations.txt:82
@@ -127,6 +152,9 @@ msgid ""
127152"database to distribute the collection's documents across a number of "
128153":program:`mongod` instances or :term:`shards <shard>`."
129154msgstr ""
155+ "MongoDB 使用 :term:`sharding` (分片)来实现水平扩展。使用分片的集群可以支持海量的数据"
156+ "和高并发读写。用户可以使用分片技术把一个数据库内的某一个集合的数据进行分区,从而达到把数据"
157+ "分布到多个 :program:`mongod` 实例(或分片上)的目的。"
130158
131159# faf0cfc9bb6b4a519232a419f554f05e
132160#: ../source/core/data-model-operations.txt:89
@@ -137,18 +165,22 @@ msgid ""
137165" prevent query isolation and increased write capacity. It is important to "
138166"consider carefully the field or fields to use as the shard key."
139167msgstr ""
168+ "Mongodb 依据 :ref:`分片键 <shard-key>` 分发数据和应用程序的事务请求。 选择一个合适的"
169+ "分片键会对性能有很大的影响,也会促进或者阻碍MongoDB的定向分片查询和增强的写性能。"
170+ "所以在选择分片键时候要仔细考量分片键盘所用的字段。"
140171
141172# 1d0e0d83902b45eab5f065ddbd217c30
142173#: ../source/core/data-model-operations.txt:96
143174msgid ""
144175"See :doc:`/core/sharding-introduction` and :doc:`/core/sharding-shard-key` "
145176"for more information."
146177msgstr ""
178+ "更多信息请参见 :doc:`/core/sharding-introduction` 及 :doc:`/core/sharding-shard-key`"
147179
148180# 6cf286141d2c4bf6ad544225faae32b7
149181#: ../source/core/data-model-operations.txt:102
150182msgid "Indexes"
151- msgstr ""
183+ msgstr "索引 "
152184
153185# c4ec41b3e83749eaa0cc0dbe4895e8c3
154186#: ../source/core/data-model-operations.txt:104
@@ -158,16 +190,18 @@ msgid ""
158190"sorted results. MongoDB automatically creates a unique index on the ``_id`` "
159191"field."
160192msgstr ""
193+ "对常用操作可以使用索引来提高性能。对查询条件中常见的字段,以及需要排序的字段创建索引。"
194+ "MongoDB会对 ``_id`` 字段自动创建唯一索引。"
161195
162196# f54f2a9ad20e41af87e0991f0128f3b3
163197#: ../source/core/data-model-operations.txt:109
164198msgid "As you create indexes, consider the following behaviors of indexes:"
165- msgstr ""
199+ msgstr "创建索引时,需要考虑索引的下述特征: "
166200
167201# 72231468638344049cea37901bc98b8c
168202#: ../source/core/data-model-operations.txt:111
169203msgid "Each index requires at least 8KB of data space."
170- msgstr ""
204+ msgstr "每个索引需要至少8KB的空间。 "
171205
172206# 8a95b086358b4b81b646e64b5967dbd5
173207#: ../source/core/data-model-operations.txt:113
@@ -176,13 +210,17 @@ msgid ""
176210"For collections with high write-to-read ratio, indexes are expensive since "
177211"each insert must also update any indexes."
178212msgstr ""
213+ "每增加一个索引,就会对写操作性能有一些影响。对于一个写多读少的集合,索引会变得很费时"
214+ "因为每个插入必须要更新所有索引。"
179215
180216# 05e68b2601d742028b516d4a80acaad6
181217#: ../source/core/data-model-operations.txt:117
182218msgid ""
183219"Collections with high read-to-write ratio often benefit from additional "
184220"indexes. Indexes do not affect un-indexed read operations."
185221msgstr ""
222+ "每增加一个索引,就会对写操作性能有一些影响。对于一个写多读少的集合,索引会变得很费时"
223+ "因为每个插入必须要更新所有索引。"
186224
187225# ade269abce404e31952d1ed33eaef26d
188226#: ../source/core/data-model-operations.txt:120
@@ -191,6 +229,8 @@ msgid ""
191229"significant and should be tracked for capacity planning, especially for "
192230"concerns over working set size."
193231msgstr ""
232+ "每个索引都会占一定的硬盘空间和内存(对于活跃的索引)。索引有可能会用到很多这样的资源,"
233+ "因此对这些资源要进行管理和规划,特别是在计算热点数据大小的时候。"
194234
195235# b347391d6c0f4815b4f9e3899d0d698d
196236#: ../source/core/data-model-operations.txt:124
@@ -200,18 +240,24 @@ msgid ""
200240":doc:`database profiler </tutorial/manage-the-database-profiler>` may help "
201241"identify inefficient queries."
202242msgstr ""
243+ "关于索引的更多信息请参见 :doc:`/applications/indexes` 以及 "
244+ ":doc:`/tutorial/analyze-query-plan/`。另外, MongoDB的 "
245+ ":doc:`database profiler </tutorial/manage-the-database-profiler>` 可以帮你"
246+ "找出一些使用索引不当而导致低效的查询。"
247+
203248
204249# 87fe1d3332af44e58acc2e945ed63d02
205250#: ../source/core/data-model-operations.txt:132
206251msgid "Large Number of Collections"
207- msgstr ""
252+ msgstr "集合的数量 "
208253
209254# c3f260f33ef54976aa5c2a431741c974
210255#: ../source/core/data-model-operations.txt:134
211256msgid ""
212257"In certain situations, you might choose to store related information in "
213258"several collections rather than in a single collection."
214259msgstr ""
260+ "在某些情况下,你可能会考虑把相关的数据保存到多个而不是一个集合里面。"
215261
216262# 82fc7a0c6070408ca0fec2e655f8ba7d
217263#: ../source/core/data-model-operations.txt:137
@@ -220,6 +266,9 @@ msgid ""
220266"environment and applications. The ``logs`` collection contains documents of "
221267"the following form:"
222268msgstr ""
269+ "我们来看一个样本集合 ``logs`` ,用来存储不同环境和应用程序的日志。 "
270+ "这个 ``logs`` 集合里面的文档例子:"
271+
223272
224273# 63d089aadd5f48b5ad69038e0340a45f
225274#: ../source/core/data-model-operations.txt:152
@@ -228,25 +277,28 @@ msgid ""
228277"performance penalty and results in very good performance. Distinct "
229278"collections are very important for high-throughput batch processing."
230279msgstr ""
280+ "一般来说,很大的集合数量对性能没有什么影响,反而在某些场景下有不错的性能。"
281+ "使用不同的集合在高并发批处理场景下会有很好的帮助。"
231282
232283# e8b2797d0de1439da9b0f34876fe96e6
233284#: ../source/core/data-model-operations.txt:156
234285msgid ""
235286"When using models that have a large number of collections, consider the "
236287"following behaviors:"
237288msgstr ""
289+ "当使用有大量集合的数据模型时,请注意一下几点:"
238290
239291# 1413106c08a04db18c322077985311af
240292#: ../source/core/data-model-operations.txt:159
241293msgid "Each collection has a certain minimum overhead of a few kilobytes."
242- msgstr ""
294+ msgstr "每一个集合有几个KB的额外开销。 "
243295
244296# 00f7f72745a642e78d8f4d28b33d7c1c
245297#: ../source/core/data-model-operations.txt:161
246298msgid ""
247299"Each index, including the index on ``_id``, requires at least 8KB of data "
248300"space."
249- msgstr ""
301+ msgstr "每一个索引,包括默认的 ``_id`` 索引, 需要至少8KB的空间。 "
250302
251303# ea25c6ecc5bd4333a869258996532cba
252304#: ../source/core/data-model-operations.txt:164
@@ -256,6 +308,9 @@ msgid ""
256308"its own entry in the namespace file. MongoDB places :limit:`limits on the "
257309"size of namespace files <Size of Namespace File>`."
258310msgstr ""
311+ "每一个MongoDB的 :term:`database` 有一个且仅一个命名文件(namespace file)(i.e. ``<database>.ns``) 。"
312+ "这个命名文件保存了数据库的所有元数据。每个索引和集合在这个文件里都有一条记录。"
313+ "这个文件的大小是有限制的,具体信息请参见: :limit:` 命名文件大小限制 <Size of Namespace File>`。"
259314
260315# e500fa36f29e4b1ea21913ba396a8b18
261316#: ../source/core/data-model-operations.txt:170
@@ -266,13 +321,18 @@ msgid ""
266321"get the current number of namespaces, run the following in the "
267322":program:`mongo` shell:"
268323msgstr ""
324+ "MongoDB 的命名文件有大小的限制: :limit:`limits on the number of namespaces <Number of "
325+ "Namespaces>`。 你可能希望知道当前命名文件的限制 - 你可以通过在"
326+ " :program:`mongo` shell: 下面执行下述命令:"
269327
270328# b22716f4be444370aceb2d8589eb5f69
271329#: ../source/core/data-model-operations.txt:182
272330msgid ""
273331"The limit on the number of namespaces depend on the ``<database>.ns`` size. "
274332"The namespace file defaults to 16 MB."
275333msgstr ""
334+ "一个命名文件中可以容纳的命名记录数取决于命名文件 ``<database>.ns`` 文件的大小。 "
335+ "命名文件默认的最大文件是16 MB。"
276336
277337# ae287cd6e7574ec885ec1c2c8c102de7
278338#: ../source/core/data-model-operations.txt:185
@@ -284,27 +344,36 @@ msgid ""
284344"impacts and considerations on running :method:`db.repairDatabase()`, see "
285345":dbcommand:`repairDatabase`."
286346msgstr ""
347+ "如欲指定*新的*命名文件的大小,使用下述参数启动 mongod: "
348+ " :option:`--nssize \\ <new size MB\\ > <--nssize>`。针对于已有的数据库"
349+ "在使用参数 :option:`--nssize` 启动之后, 再在 :program:`mongo` 下面运行命令"
350+ " :method:`db.repairDatabase()` 。 运行 :method:`db.repairDatabase()` 的时候"
351+ "有一些注意事项,详情请参见 :dbcommand:`repairDatabase` 。"
287352
288353# f1194abdcdad498095a4f9a9fcd266cf
289354#: ../source/core/data-model-operations.txt:194
290355msgid "Data Lifecycle Management"
291- msgstr ""
356+ msgstr "数据生命周期 "
292357
293358# 853f694f41c7479b9acaa1f9a43d1527
294359#: ../source/core/data-model-operations.txt:196
295360msgid ""
296361"Data modeling decisions should take data lifecycle management into "
297362"consideration."
298363msgstr ""
364+ "在做数据建模方面的决定时我们也需要考虑数据的生命周期。"
299365
300366# 845eba8d052c475faca7a7ea53b526e0
301367#: ../source/core/data-model-operations.txt:199
302368msgid ""
303- "The :doc:`Time to Live or TTL feature </tutorial/expire-data>` of "
369+ "MongoDB :doc:`Time to Live or TTL feature </tutorial/expire-data>` of "
304370"collections expires documents after a period of time. Consider using the TTL"
305371" feature if your application requires some data to persist in the database "
306372"for a limited period of time."
307373msgstr ""
374+ "MongoDB集合的 :doc:`Time to Live or TTL feature </tutorial/expire-data>` 功能 "
375+ "可以用来自动删除一些有效期到期的数据。 如果你的应用程序中有这样一些数据,他们只需要在"
376+ "数据库中保留一段时间,比如说几个小时或者几天,那么你可以考虑采用 TTL 功能来实现这一点。"
308377
309378# 3961ee91cb3849e694ef634be25d2725
310379#: ../source/core/data-model-operations.txt:204
@@ -314,6 +383,10 @@ msgid ""
314383"in-first-out* (FIFO) management of inserted documents and efficiently "
315384"support operations that insert and read documents based on insertion order."
316385msgstr ""
386+ "另外,如果你的应用程序只需要使用最近一段时间插入的文档,你也可以考虑使用 ``封顶集合`` "
387+ " (:doc:`/core/capped-collections`)。 封顶集合采用先进先出 *first-"
388+ "in-first-out* (FIFO) 的策略管理插入的文档。它对插入文档和按插入顺序读文档的操作"
389+ "有非常好的支持。"
317390
318391#: ../source/core/data-model-operations.txt:25
319392msgid ""
@@ -326,6 +399,12 @@ msgid ""
326399"allocations <record-allocation-strategies>` to minimize the likelihood of "
327400"relocation, data models should avoid document growth when possible."
328401msgstr ""
402+ "有一些更新操作会导致文档的大小增加,例如添加元素到数组 (i.e. :update:`$push`) "
403+ "以及在文档内添加新的字段等。 加入文档的大小超出原先分配给它的空间, MongoDB会把这个"
404+ "文档迁移到硬盘的另外一个位置。迁移文档比 *原位更新* 要耗时,也会因此而导致磁盘的碎片问题。"
405+ "虽然MongoDB会采取一些手段去尽可能防止这种迁移的发生,如在文档插入时候会对其"
406+ " :ref:`额外分配填充空间 <record-allocation-strategies>`,"
407+ "在做数据建模的时候还是要考虑尽可能做到减少文档的增长。"
329408
330409#: ../source/core/data-model-operations.txt:146
331410msgid ""
@@ -334,6 +413,9 @@ msgid ""
334413" such as ``logs_dev`` and ``logs_debug``. The ``logs_dev`` collection would "
335414"contain only the documents related to the dev environment."
336415msgstr ""
416+ "如果文档的总数不是很大,你可以把文档按类型进行分组。在日志这个应用场景,不同的环境可以"
417+ "考虑使用不同的集合,如``logs_dev`` 及 ``logs_debug`` 等。 其中 ``logs_dev`` 集合"
418+ "包含所有dev环境中的文档。"
337419
338420#~ msgid ""
339421#~ "Some updates to documents can increase the size of documents. These updates "
0 commit comments