@@ -88,8 +88,8 @@ Example
88
88
89
89
The following example performs the following actions:
90
90
91
- - Matches documents where the ``species`` is "Ledebouria socialis" and
92
- the ``plant_id`` is ``3``
91
+ - Matches documents where the ``species`` is `` "Ledebouria socialis"``
92
+ and the ``plant_id`` is ``3``
93
93
- Updates the ``height`` of the matched document to ``8.3``
94
94
- Inserts this document if there are no matches to the query filter
95
95
@@ -101,7 +101,7 @@ The following example performs the following actions:
101
101
102
102
filter := bson.D{{"species", "Ledebouria socialis"}, {"plant_id", 3}}
103
103
update := bson.D{{"$set", bson.D{{"species", "Ledebouria socialis"}, {"plant_id", 3}, {"height", 8.3}}}}
104
- opts := options.Update ().SetUpsert(true)
104
+ options.UpdateOne ().SetUpsert(true)
105
105
106
106
result, err := coll.UpdateOne(context.TODO(), filter, update, opts)
107
107
if err != nil {
@@ -152,6 +152,6 @@ guide, see the following API Documentation:
152
152
- `ReplaceOne() <{+api+}/mongo#Collection.ReplaceOne>`__
153
153
- `FindOneAndUpdate() <{+api+}/mongo#Collection.FindOneAndUpdate>`__
154
154
- `FindOneAndReplace() <{+api+}/mongo#Collection.FindOneAndReplace>`__
155
- - `UpdateOptions .SetUpsert() <{+api+}/mongo/options#UpdateOptions .SetUpsert>`__
156
- - `ReplaceOptions .SetUpsert() <{+api+}/mongo/options#ReplaceOptions .SetUpsert>`__
155
+ - `UpdateOneOptionsBuilder .SetUpsert() <{+api+}/mongo/options#UpdateOneOptionsBuilder .SetUpsert>`__
156
+ - `ReplaceOptionsBuilder .SetUpsert() <{+api+}/mongo/options#ReplaceOptionsBuilder .SetUpsert>`__
157
157
- `UpdateResult <{+api+}/mongo#UpdateResult>`__
0 commit comments