Skip to content

Commit

Permalink
Docsp 30927 work with bson options (#278)
Browse files Browse the repository at this point in the history
* DOCSP-30927-Work-With-BSON-Options

* DOCSP-30927-Work-With-BSON-Options

* DOCSP-30927-Work-With-BSON-Options

* remove table

* revision

* revision
  • Loading branch information
nickldp authored Jul 11, 2023
1 parent f7d1a93 commit 41298c8
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions source/fundamentals/bson.txt
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,30 @@ Driver will marshal structs using the following rules:
- Includes an empty ``lastname`` field
- Stores the ``Address`` field as a nested value

BSON Options
------------

You can set ``BSONOptions`` to specify how
the driver marshals and unmarshals BSON on your collection, database, or
client.

The following example demonstrates how to set ``BSONOptions`` for
the ``movies`` collection:

.. code-block:: go
:copyable: false

bsonOpts := &options.BSONOptions {
UseJSONStructTags: true,
}
coll := client.Database("sample_mflix")
.Collection("movies",bsonOpts)

.. tip::

To learn more about ``BSONOptions``, see the `API Documentation
<{+api+}/mongo#example-Connect-BSONOptions>`__.

.. _golang-bson-unmarshalling:

Unmarshalling
Expand Down

0 comments on commit 41298c8

Please sign in to comment.