Skip to content

Commit

Permalink
DOCSP-35287 Fix incorrect BSON option (#329) (#330)
Browse files Browse the repository at this point in the history
(cherry picked from commit bacbc5f)
  • Loading branch information
jordan-smith721 authored Jan 3, 2024
1 parent 596153e commit 469d7c8
Showing 1 changed file with 9 additions and 4 deletions.
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

0 comments on commit 469d7c8

Please sign in to comment.