Skip to content

Commit c6644a4

Browse files
committed
DOCS-617 merge and edit the bson doc
1 parent aa74fd3 commit c6644a4

File tree

3 files changed

+68
-42
lines changed

3 files changed

+68
-42
lines changed

draft/core/documents.txt renamed to draft/core/document.txt

Lines changed: 63 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ BSON Documents
44

55
.. default-domain:: mongodb
66

7-
MongoDB is a document-based database system, and as a result all
8-
records, or data in MongoDB are documents. Documents are the default
7+
MongoDB is a document-based database system, and as a result, all
8+
records, or data, in MongoDB are documents. Documents are the default
99
representation of most user accessible data structures in the
10-
database. Document's provide structure for data in the following
10+
database. Documents provide structure for data in the following
1111
MongoDB contexts:
1212

1313
- the :ref:`records <documents-records>` stored in :term:`collections
@@ -26,10 +26,15 @@ MongoDB contexts:
2626
- :ref:`sort order <documents-sort-order>` for the :method:`sort()
2727
<cursor.sort()>` method.
2828

29-
- index specification for the :method:`hint() <cursor.hint()>`
30-
method.
29+
- :ref:`index specification <documents-index>` for the
30+
:method:`hint() <cursor.hint()>` method.
3131

32-
.. status output, link to examples of server stats/coll stats/etc. (?)
32+
- the various outputs from commands and operations, such as:
33+
34+
- the output of :dbcommand:`collStats` command
35+
36+
- the output of :doc:`db.serverStatus
37+
</reference/server-status-index>` command
3338

3439
Structure
3540
---------
@@ -54,13 +59,35 @@ documents may contain field and value pairs where the value can be
5459
another document, an array, an array of documents as well
5560
as the basic types such as ``Double``, ``String``, or ``Date``.
5661

57-
.. give more examples of:
62+
Consider the following document that contains values of varying
63+
types:
64+
65+
.. code-block:: javascript
66+
67+
{
68+
_id: ObjectId("5099803df3f4948bd2f98391"),
69+
name: { first: "Alan", last: "Turing" },
70+
birth: new Date('Jun 23, 1912'),
71+
death: new Date('Jun 07, 1954'),
72+
contribs: [ "Turing machine", "Turing test", "Turingery" ],
73+
views : NumberLong(1250000),
74+
update : Timestamp(1352237167000, 1)
75+
}
76+
77+
The document contains the following fields:
78+
79+
- field ``_id`` whose value is an *ObjectId*
80+
81+
- field ``name`` whose value is another *Document* that contains the
82+
fields ``first`` and ``last``
83+
84+
- fields ``birth`` and ``death`` whose value is a *Date*
5885

59-
- special bson types NumberLong(), Timestamp, etc.
86+
- field ``contribs`` whose value is an *array of Strings*
6087

61-
- nested document.
88+
- field ``views`` whose value is a *NumberLong*
6289

63-
- with arrays
90+
- field ``update`` whose value is a *Timestamp*
6491

6592
Types
6693
-----
@@ -71,17 +98,14 @@ Record Documents
7198
~~~~~~~~~~~~~~~~
7299

73100
Most documents in MongoDB are records in :term:`collections` which
74-
store data from users' applications. These documents have the
75-
following limitations:
101+
store data from users' applications.
102+
103+
These documents have the following limitations:
76104

77105
- .. include:: /includes/fact-document-max-size.rst
78106

79107
- .. include:: /includes/fact-document-field-name-restrictions.rst
80108

81-
.. these should be links to the limit page or include those links. We
82-
should make these things centrally referenced to limit the number
83-
of places these data points exist *if* any of them ever change.
84-
85109
.. include:: /includes/note-insert-id-field.rst
86110

87111
The following document specifies a record in a collection:
@@ -124,19 +148,13 @@ The document contains the following fields:
124148
Query Specification Documents
125149
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
126150

127-
.. this section should have a better lead in. I think we should be
128-
able to avoid the bulleted list here, which affects flow...
129-
130-
Query selector documents may contain any or all of the following:
131-
132-
- Simple field and value pair(s) to specify the equality
133-
condition.
134-
135-
.. we should attempt to avoid issuing qualitative judgements about
136-
complexity or simplicity.
137-
138-
- :doc:`Query operator </reference/operators>` expressions to specify
139-
other conditions.
151+
Query selector documents specify the conditions that determine which
152+
records to select for read, update, and delete operations. You can use
153+
field and value expressions to specify the equality condition and
154+
:doc:`query operator </reference/operators>` expressions to specify
155+
additional conditions. Refer to :doc:`read </applications/read>`,
156+
:doc:`update </applications/update>`, and :doc:`delete
157+
</applications/delete>` pages for more examples.
140158

141159
Consider the following examples of query selector documents:
142160

@@ -188,10 +206,12 @@ for MongoDB to return, remove, or update, as in the following:
188206
Update Specification Documents
189207
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
190208

191-
.. when are they used, links to cross reference material to provide context
192-
193-
The update actions documents contain :ref:`update operators
194-
<update-operators>` expressions.
209+
The update action documents specify the data modifications to perform
210+
during an :method:`update() <db.collection.update()>` operation to
211+
modify existing records in a collection. You can use :ref:`update
212+
operators <update-operators>` to specify the exact actions to perform
213+
on the document fields. See the :ref:`update operators
214+
<update-operators>` page for the available update operators and syntax.
195215

196216
Consider the following example of an update actions document:
197217

@@ -227,8 +247,10 @@ When passed as an argument to the :method:`update()
227247
Index Specifier Documents
228248
~~~~~~~~~~~~~~~~~~~~~~~~~
229249

230-
.. what are index documents? when are they used? cross reference links
231-
would provide a lot of the required documentation.
250+
Indexes improve the efficiency of :doc:`read </applications/read>`
251+
operations. Index documents specify the fields to index on during the
252+
:method:`index creation <db.collection.ensureIndex()>` operation. See
253+
:doc:`indexes </core/indexes>` for an overview of indexes.
232254

233255
The index documents contain field and value pairs where:
234256

@@ -257,7 +279,11 @@ the index to create:
257279
Sort Order Specification Documents
258280
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
259281

260-
.. where? context?
282+
The sort order documents specify the order of documents that a
283+
:method:`query() <db.collection.find()>` returns. The sort order
284+
document is passed as an argument to the :method:`sort()
285+
<cursor.sort()>` method. See the :method:`sort() <cursor.sort()>` page
286+
for more information on sorting.
261287

262288
The sort order documents contain field and value pairs where:
263289

@@ -266,7 +292,7 @@ The sort order documents contain field and value pairs where:
266292
- the ``value`` is either 1 for ascending or -1 for descending.
267293

268294
The following document specifies the sort order using the fields from a
269-
subdocument ``name``: first sort by the ``last`` field ascending, then
295+
subdocument ``name`` first sort by the ``last`` field ascending, then
270296
by the ``first`` field also ascending:
271297

272298
.. code-block:: javascript
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
Documents have a 16 megabytes size limit.
1+
The maximum BSON document size is 16 megabytes.
22

33
The maximum document size helps ensure that a single document cannot
44
use excessive amount of RAM or, during transmission, excessive amount
5-
of bandwidth. To store larger objects, MongoDB provides the
6-
GridFS API to handle documents larger than the maximum size. See your
7-
specific driver documentation for GridFS.
5+
of bandwidth. To store larger objects, MongoDB provides the GridFS API
6+
to handle documents larger than the maximum size. See your specific
7+
driver documentation for GridFS.

source/reference/limits.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ BSON Documents
1919
.. _limit-bson-document-size:
2020
.. limit:: BSON Document Size
2121

22-
The maximum BSON document size is 16 megabytes.
22+
.. include:: /includes/fact-document-max-size.rst
2323

2424
.. _limit-nested-depth:
2525
.. limit:: Nested Depth for BSON Documents

0 commit comments

Comments
 (0)