Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOCSP-35287 Fix incorrect BSON option (#329) #330

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions source/fundamentals/bson.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@
Work with BSON
==============

.. default-domain:: mongodb

.. contents:: On this page
:local:
:backlinks: none
:depth: 2
:class: singlecol

.. facet::
:name: genre
:values: reference

.. meta::
:keywords: code examples, serialization

Overview
--------

Expand Down Expand Up @@ -219,7 +224,7 @@ This example performs the following actions:

- Sets the ``UseJSONStructTags`` field to ``true``, which instructs the driver
to use the ``"json"`` struct tag if a ``"bson"`` struct tag is not specified
- Sets the ``OmitZeroStruct`` field to ``true``, which instructs the driver
- Sets the ``NilSliceAsEmpty`` field to ``true``, which instructs the driver
to marshal ``nil`` Go slices as empty BSON arrays

- Passes the ``BSONOptions`` instance to the ``SetBSONOptions()`` helper method to specify
Expand All @@ -230,7 +235,7 @@ This example performs the following actions:

bsonOpts := &options.BSONOptions {
UseJSONStructTags: true,
OmitZeroStruct: true,
NilSliceAsEmpty: true,
}

clientOpts := options.Client().
Expand Down
Loading