@@ -11,25 +11,13 @@ var DefaultOrdered = true
1111
1212// BulkWriteOptions represents arguments that can be used to configure a
1313// BulkWrite operation.
14+ //
15+ // See corresponding setter methods for documentation.
1416type BulkWriteOptions struct {
15- // If true, writes executed as part of the operation will opt out of document-level validation on the server. This
16- // option is valid for MongoDB versions >= 3.2 and is ignored for previous server versions. The default value is
17- // false. See https://www.mongodb.com/docs/manual/core/schema-validation/ for more information about document
18- // validation.
1917 BypassDocumentValidation * bool
20-
21- // A string or document that will be included in server logs, profiling logs, and currentOp queries to help trace
22- // the operation. The default value is nil, which means that no comment will be included in the logs.
23- Comment interface {}
24-
25- // If true, no writes will be executed after one fails. The default value is true.
26- Ordered * bool
27-
28- // Specifies parameters for all update and delete commands in the BulkWrite. This option is only valid for MongoDB
29- // versions >= 5.0. Older servers will report an error for using this option. This must be a document mapping
30- // parameter names to values. Values must be constant or closed expressions that do not reference document fields.
31- // Parameters can then be accessed as variables in an aggregate expression context (e.g. "$$var").
32- Let interface {}
18+ Comment interface {}
19+ Ordered * bool
20+ Let interface {}
3321}
3422
3523// BulkWriteOptionsBuilder contains options to configure bulk write operations.
@@ -52,7 +40,9 @@ func (b *BulkWriteOptionsBuilder) List() []func(*BulkWriteOptions) error {
5240 return b .Opts
5341}
5442
55- // SetComment sets the value for the Comment field.
43+ // SetComment sets the value for the Comment field. Specifies a string or document that will be included in
44+ // server logs, profiling logs, and currentOp queries to help tracethe operation. The default value is nil,
45+ // which means that no comment will be included in the logs.
5646func (b * BulkWriteOptionsBuilder ) SetComment (comment interface {}) * BulkWriteOptionsBuilder {
5747 b .Opts = append (b .Opts , func (opts * BulkWriteOptions ) error {
5848 opts .Comment = comment
@@ -63,7 +53,8 @@ func (b *BulkWriteOptionsBuilder) SetComment(comment interface{}) *BulkWriteOpti
6353 return b
6454}
6555
66- // SetOrdered sets the value for the Ordered field.
56+ // SetOrdered sets the value for the Ordered field. If true, no writes will be executed after one fails.
57+ // The default value is true.
6758func (b * BulkWriteOptionsBuilder ) SetOrdered (ordered bool ) * BulkWriteOptionsBuilder {
6859 b .Opts = append (b .Opts , func (opts * BulkWriteOptions ) error {
6960 opts .Ordered = & ordered
@@ -74,7 +65,11 @@ func (b *BulkWriteOptionsBuilder) SetOrdered(ordered bool) *BulkWriteOptionsBuil
7465 return b
7566}
7667
77- // SetBypassDocumentValidation sets the value for the BypassDocumentValidation field.
68+ // SetBypassDocumentValidation sets the value for the BypassDocumentValidation field. If true, writes
69+ // executed as part of the operation will opt out of document-level validation on the server. This option
70+ // is valid for MongoDB versions >= 3.2 and is ignored for previous server versions. The default value is
71+ // false. See https://www.mongodb.com/docs/manual/core/schema-validation/ for more information about document
72+ // validation.
7873func (b * BulkWriteOptionsBuilder ) SetBypassDocumentValidation (bypass bool ) * BulkWriteOptionsBuilder {
7974 b .Opts = append (b .Opts , func (opts * BulkWriteOptions ) error {
8075 opts .BypassDocumentValidation = & bypass
0 commit comments