Skip to content

Commit 31a29d5

Browse files
authored
Merge pull request #926 from saghm/RUBY-1321
RUBY-1321 Update documentation to reflect Symbol deprecation
2 parents 12a8809 + 5b9cee4 commit 31a29d5

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

source/tutorials/ruby-driver-crud-operations.txt

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ Additional Query Operations
247247
client = Mongo::Client.new([ '127.0.0.1:27017' ], :database => 'music')
248248

249249
client[:artists].find.distinct(:name )
250-
250+
251251
Tailable Cursors
252252
~~~~~~~~~~~~~~~~
253253

@@ -338,10 +338,10 @@ matches a secondary server with tag set ``{ dc: 'ny', rack: 2, size: 'large' }``
338338

339339
A tag set that is an empty document matches any server, because
340340
the empty tag set is a subset of any tag set. This means the default
341-
``tag_sets`` parameter ``[{}]`` matches all servers.
341+
``tag_sets`` parameter ``[{}]`` matches all servers.
342342

343343
.. _ruby-driver-updating:
344-
344+
345345
Updating
346346
--------
347347

@@ -460,3 +460,14 @@ Deleting
460460

461461
result = artists.delete_many(:label => 'Mute')
462462
result.deleted_count # Returns the number deleted.
463+
464+
A Note about the BSON Symbol type
465+
---------------------------------
466+
467+
Because the BSON specification deprecated the BSON symbol type, the `bson` gem
468+
will serialize Ruby symbols into BSON strings when used on its own. However, in
469+
order to maintain backwards compatibility with older datasets, the Ruby driver
470+
overrides this behavior to serialize Ruby symbols as BSON symbols. This is
471+
necessary to be able to specify queries for documents which contain BSON
472+
symbols as fields. Despite this, new documents with symbol type fields should
473+
*not* be stored in the database; instead, use string fields.

0 commit comments

Comments
 (0)