Skip to content

Commit 24c6a9c

Browse files
p-mongop
andauthored
Change headings to be consistent with driver docs (#220)
Co-authored-by: Oleg Pudeyev <[email protected]>
1 parent ff9f5a7 commit 24c6a9c

File tree

2 files changed

+45
-45
lines changed

2 files changed

+45
-45
lines changed

docs/tutorials/bson-v3.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
.. _ruby-bson-tutorial:
44

5-
=================
5+
*****************
66
BSON 3.x Tutorial
7-
=================
7+
*****************
88

99
.. default-domain:: mongodb
1010

@@ -17,7 +17,7 @@ BSON 3.x Tutorial
1717
This tutorial discusses using the core Ruby BSON gem.
1818

1919
Installation
20-
------------
20+
============
2121

2222
The BSON library is hosted on `Rubygems <http://rubygems.org>`_ and can be
2323
installed manually or with bundler.
@@ -39,7 +39,7 @@ and Rubinius 2.5.x
3939

4040

4141
BSON Serialization
42-
------------------
42+
==================
4343

4444
Getting a Ruby object's raw BSON representation is done by calling ``to_bson``
4545
on the Ruby object. For example:
@@ -77,7 +77,7 @@ In addition to the core Ruby objects, BSON also provides some special types
7777
specific to the specification:
7878

7979
``BSON::Binary``
80-
````````````````
80+
----------------
8181

8282
This is a representation of binary data, and must provide the raw data and
8383
a subtype when constructing.
@@ -97,7 +97,7 @@ Valid subtypes are:
9797
- ``:user``
9898

9999
``BSON::Code``
100-
``````````````
100+
--------------
101101

102102
Represents a string of Javascript code.
103103

@@ -106,7 +106,7 @@ Represents a string of Javascript code.
106106
BSON::Code.new("this.value = 5;")
107107

108108
``BSON::CodeWithScope``
109-
```````````````````````
109+
-----------------------
110110

111111
Represents a string of Javascript code with a hash of values.
112112

@@ -115,7 +115,7 @@ Represents a string of Javascript code with a hash of values.
115115
BSON::CodeWithScope.new("this.value = age;", age: 5)
116116

117117
``BSON::Document``
118-
``````````````````
118+
------------------
119119

120120
This is a subclass of a hash that stores all keys as strings but allows access to
121121
them with symbol keys.
@@ -126,7 +126,7 @@ them with symbol keys.
126126
BSON::Document.new
127127

128128
``BSON::MaxKey``
129-
````````````````
129+
----------------
130130

131131
Represents a value in BSON that will always compare higher to another value.
132132

@@ -135,7 +135,7 @@ Represents a value in BSON that will always compare higher to another value.
135135
BSON::MaxKey.new
136136

137137
``BSON::MinKey``
138-
````````````````
138+
----------------
139139

140140
Represents a value in BSON that will always compare lower to another value.
141141

@@ -144,7 +144,7 @@ Represents a value in BSON that will always compare lower to another value.
144144
BSON::MinKey.new
145145

146146
``BSON::ObjectId``
147-
``````````````````
147+
------------------
148148

149149
Represents a 12 byte unique identifier for an object on a given machine.
150150

@@ -153,7 +153,7 @@ Represents a 12 byte unique identifier for an object on a given machine.
153153
BSON::ObjectId.new
154154

155155
``BSON::Timestamp``
156-
```````````````````
156+
-------------------
157157

158158
Represents a special time with a start and increment value.
159159

@@ -162,7 +162,7 @@ Represents a special time with a start and increment value.
162162
BSON::Timestamp.new(5, 30)
163163

164164
``BSON::Undefined``
165-
```````````````````
165+
-------------------
166166

167167
Represents a placeholder for a value that was not provided.
168168

@@ -171,7 +171,7 @@ Represents a placeholder for a value that was not provided.
171171
BSON::Undefined.new
172172

173173
JSON Serialization
174-
------------------
174+
==================
175175

176176
Some BSON types have special representations in JSON. These are as follows
177177
and will be automatically serialized in the form when calling ``to_json`` on
@@ -210,15 +210,15 @@ them.
210210

211211

212212
Special Ruby Date Classes
213-
-------------------------
213+
=========================
214214

215215
Ruby's ``Date`` and ``DateTime`` are able to be serialized, but when
216216
they are deserialized they will always be returned as a ``Time`` since the BSON
217217
specification only has a ``Time`` type and knows nothing about Ruby.
218218

219219

220220
Compiling Regexes
221-
-----------------
221+
=================
222222

223223
When regular expressions are deserialized, they return a wrapper that holds the
224224
raw regex string, but does not compile it. In order to get the Ruby ``Regexp``

docs/tutorials/bson-v4.txt

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
.. _ruby-bson-tutorial-4-0:
44

5-
=================
5+
*****************
66
BSON 4.x Tutorial
7-
=================
7+
*****************
88

99
.. default-domain:: mongodb
1010

@@ -17,7 +17,7 @@ BSON 4.x Tutorial
1717
This tutorial discusses using the Ruby BSON library.
1818

1919
Installation
20-
------------
20+
============
2121

2222
The BSON library can be installed from `Rubygems <http://rubygems.org>`_
2323
manually or with bundler.
@@ -37,7 +37,7 @@ To install the gem with bundler, include the following in your ``Gemfile``:
3737
The BSON library is compatible with MRI >= 2.3 and JRuby >= 9.2.
3838

3939
Use With ActiveSupport
40-
----------------------
40+
======================
4141

4242
Serialization for ActiveSupport-defined classes, such as TimeWithZone, is
4343
not loaded by default to avoid a hard dependency of BSON on ActiveSupport.
@@ -50,7 +50,7 @@ ActiveSupport-related code must be explicitly required:
5050
require 'bson/active_support'
5151

5252
BSON Serialization
53-
------------------
53+
==================
5454

5555
Getting a Ruby object's raw BSON representation is done by calling ``to_bson``
5656
on the Ruby object, which will return a ``BSON::ByteBuffer``. For example:
@@ -70,13 +70,13 @@ you wish to instantiate and passing it a ``BSON::ByteBuffer`` instance.
7070

7171

7272
Byte Buffers
73-
------------
73+
============
7474

7575
BSON library 4.0 introduces the use of native byte buffers in MRI and JRuby
7676
instead of using ``StringIO``, for improved performance.
7777

7878
Writing
79-
```````
79+
-------
8080

8181
To create a ``ByteBuffer`` for writing (i.e. serializing to BSON),
8282
instantiate ``BSON::ByteBuffer`` with no arguments:
@@ -184,7 +184,7 @@ over a socket), call ``to_s`` on the buffer:
184184

185185

186186
Reading
187-
```````
187+
-------
188188

189189
To create a ``ByteBuffer`` for reading (i.e. deserializing from BSON),
190190
instantiate ``BSON::ByteBuffer`` with a byte string as the argument:
@@ -218,7 +218,7 @@ To restart reading from the beginning of a buffer, use ``rewind``:
218218

219219

220220
Supported Classes
221-
-----------------
221+
=================
222222

223223
Core Ruby classes that have representations in the BSON specification and
224224
will have a ``to_bson`` method defined for them are: ``Object``, ``Array``,
@@ -230,7 +230,7 @@ specific to the specification:
230230

231231

232232
``BSON::Binary``
233-
````````````````
233+
----------------
234234

235235
Use ``BSON::Binary`` objects to store arbitrary binary data. The ``Binary``
236236
objects can be constructed from binary strings as follows:
@@ -281,7 +281,7 @@ The data and the subtype can be retrieved from ``Binary`` instances using
281281
# => #<Encoding:ASCII-8BIT>
282282

283283
UUID Methods
284-
~~~~~~~~~~~~
284+
````````````
285285

286286
To create a UUID BSON::Binary (binary subtype 4) from its RFC 4122-compliant
287287
string representation, use the ``from_uuid`` method:
@@ -314,7 +314,7 @@ Note that the ``:standard`` representation can only be used with a Binary
314314
of subtype ``:uuid`` (not ``:uuid_old``).
315315

316316
Legacy UUIDs
317-
~~~~~~~~~~~~
317+
````````````
318318

319319
Data stored in BSON::Binary objects of subtype 3 (``:uuid_old``) may be
320320
persisted in one of three different byte orders depending on which driver
@@ -381,7 +381,7 @@ These methods can be used to convert from one representation to another:
381381

382382

383383
``BSON::Code``
384-
``````````````
384+
--------------
385385

386386
Represents a string of JavaScript code.
387387

@@ -390,7 +390,7 @@ Represents a string of JavaScript code.
390390
BSON::Code.new("this.value = 5;")
391391

392392
``BSON::CodeWithScope``
393-
```````````````````````
393+
-----------------------
394394

395395
.. note::
396396

@@ -406,7 +406,7 @@ Represents a string of JavaScript code with a hash of values.
406406
BSON::CodeWithScope.new("this.value = age;", age: 5)
407407

408408
``BSON::Document``
409-
``````````````````
409+
------------------
410410

411411
This is a subclass of ``Hash`` that stores all keys as strings, but allows
412412
access to them with symbol keys.
@@ -431,7 +431,7 @@ access to them with symbol keys.
431431

432432

433433
``BSON::MaxKey``
434-
````````````````
434+
----------------
435435

436436
Represents a value in BSON that will always compare higher to another value.
437437

@@ -440,7 +440,7 @@ Represents a value in BSON that will always compare higher to another value.
440440
BSON::MaxKey.new
441441

442442
``BSON::MinKey``
443-
````````````````
443+
----------------
444444

445445
Represents a value in BSON that will always compare lower to another value.
446446

@@ -449,7 +449,7 @@ Represents a value in BSON that will always compare lower to another value.
449449
BSON::MinKey.new
450450

451451
``BSON::ObjectId``
452-
``````````````````
452+
------------------
453453

454454
Represents a 12 byte unique identifier for an object on a given machine.
455455

@@ -458,7 +458,7 @@ Represents a 12 byte unique identifier for an object on a given machine.
458458
BSON::ObjectId.new
459459

460460
``BSON::Timestamp``
461-
```````````````````
461+
-------------------
462462

463463
Represents a special time with a start and increment value.
464464

@@ -467,7 +467,7 @@ Represents a special time with a start and increment value.
467467
BSON::Timestamp.new(5, 30)
468468

469469
``BSON::Undefined``
470-
```````````````````
470+
-------------------
471471

472472
Represents a placeholder for a value that was not provided.
473473

@@ -476,7 +476,7 @@ Represents a placeholder for a value that was not provided.
476476
BSON::Undefined.new
477477

478478
``BSON::Decimal128``
479-
````````````````````
479+
--------------------
480480

481481
Represents a 128-bit decimal-based floating-point value capable of emulating
482482
decimal rounding with exact precision.
@@ -491,7 +491,7 @@ decimal rounding with exact precision.
491491
BSON::Decimal128.new(d)
492492

493493
``Symbol``
494-
``````````
494+
----------
495495

496496
The BSON specification defines a symbol type which allows round-tripping
497497
Ruby ``Symbol`` values (i.e., a Ruby ``Symbol``is encoded into a BSON symbol
@@ -538,7 +538,7 @@ To force encoding of Ruby symbols to BSON symbols, wrap the Ruby symbols in
538538
# => "\x12\x00\x00\x00\x0Efoo\x00\x04\x00\x00\x00bar\x00\x00"
539539

540540
JSON Serialization
541-
------------------
541+
==================
542542

543543
Some BSON types have special representations in JSON. These are as follows
544544
and will be automatically serialized in the form when calling ``to_json`` on
@@ -577,7 +577,7 @@ them.
577577

578578

579579
Time Instances
580-
--------------
580+
==============
581581

582582
Times in Ruby can have nanosecond precision. Times in BSON (and MongoDB)
583583
can only have millisecond precision. When Ruby ``Time`` instances are
@@ -610,7 +610,7 @@ calculations may produce unexpected results.
610610

611611

612612
DateTime Instances
613-
------------------
613+
==================
614614

615615
BSON only supports storing the time as the number of seconds since the
616616
Unix epoch. Ruby's ``DateTime`` instances can be serialized to BSON,
@@ -624,7 +624,7 @@ database.
624624

625625

626626
Date Instances
627-
--------------
627+
==============
628628

629629
BSON only supports storing the time as the number of seconds since the
630630
Unix epoch. Ruby's ``Date`` instances can be serialized to BSON, but when
@@ -635,7 +635,7 @@ of the day that the ``Date`` refers to in UTC.
635635

636636

637637
Regular Expressions
638-
-------------------
638+
===================
639639

640640
Ruby regular expressions always have BSON regular expressions' equivalent of
641641
'm' flag on. In order for behavior to be preserved between the two, the 'm'
@@ -683,7 +683,7 @@ object, one must call ``compile`` on the returned object.
683683

684684

685685
Key Order
686-
---------
686+
=========
687687

688688
BSON documents preserve the order of keys, because the documents are stored
689689
as lists of key-value pairs. Hashes in Ruby also preserve key order; thus
@@ -693,7 +693,7 @@ the order of keys in the document will match the order of keys in the hash.
693693

694694

695695
Duplicate Keys
696-
--------------
696+
==============
697697

698698
BSON specification allows BSON documents to have duplicate keys, because the
699699
documents are stored as lists of key-value pairs. Applications should refrain

0 commit comments

Comments
 (0)