| 1 | // Copyright (C) MongoDB, Inc. 2017-present. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | // not use this file except in compliance with the License. You may obtain |
| 5 | // a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 |
| 6 | |
| 7 | package optionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/ |
| 8 | |
| 9 | // DefaultOrdered is the default value for the Ordered option in BulkWriteOptions. |
| 10 | var DefaultOrderedscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/DefaultOrdered. = true |
| 11 | |
| 12 | // BulkWriteOptions represents options that can be used to configure a BulkWrite operation. |
| 13 | type BulkWriteOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions# struct { |
| 14 | // If true, writes executed as part of the operation will opt out of document-level validation on the server. This |
| 15 | // option is valid for MongoDB versions >= 3.2 and is ignored for previous server versions. The default value is |
| 16 | // false. See https://www.mongodb.com/docs/manual/core/schema-validation/ for more information about document |
| 17 | // validation. |
| 18 | BypassDocumentValidationscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#BypassDocumentValidation. *bool |
| 19 | |
| 20 | // A string or document that will be included in server logs, profiling logs, and currentOp queries to help trace |
| 21 | // the operation. The default value is nil, which means that no comment will be included in the logs. |
| 22 | Commentscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#Comment. interface{} |
| 23 | |
| 24 | // If true, no writes will be executed after one fails. The default value is true. |
| 25 | Orderedscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#Ordered. *bool |
| 26 | |
| 27 | // Specifies parameters for all update and delete commands in the BulkWrite. This option is only valid for MongoDB |
| 28 | // versions >= 5.0. Older servers will report an error for using this option. This must be a document mapping |
| 29 | // parameter names to values. Values must be constant or closed expressions that do not reference document fields. |
| 30 | // Parameters can then be accessed as variables in an aggregate expression context (e.g. "$$var"). |
| 31 | Letscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#Let. interface{} |
| 32 | |
| 33 | // If true, the server accepts empty Timestamp as a literal rather than replacing it with the current time. |
| 34 | // |
| 35 | // Deprecated: This option is for internal use only and should not be set. It may be changed or removed in any |
| 36 | // release. |
| 37 | BypassEmptyTsReplacementscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#BypassEmptyTsReplacement. *bool |
| 38 | } |
| 39 | |
| 40 | // BulkWrite creates a new *BulkWriteOptions instance. |
| 41 | func BulkWritescip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWrite().() *BulkWriteOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions# { |
| 42 | return &BulkWriteOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#{ |
| 43 | Orderedscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#Ordered.: &DefaultOrderedscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/DefaultOrdered., |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | // SetComment sets the value for the Comment field. |
| 48 | func (b *BulkWriteOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#) SetCommentscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#SetComment().(comment interface{}) *BulkWriteOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions# { |
| 49 | b.Commentscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#Comment. = comment |
| 50 | return b |
| 51 | } |
| 52 | |
| 53 | // SetOrdered sets the value for the Ordered field. |
| 54 | func (b *BulkWriteOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#) SetOrderedscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#SetOrdered().(ordered bool) *BulkWriteOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions# { |
| 55 | b.Orderedscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#Ordered. = &ordered |
| 56 | return b |
| 57 | } |
| 58 | |
| 59 | // SetBypassDocumentValidation sets the value for the BypassDocumentValidation field. |
| 60 | func (b *BulkWriteOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#) SetBypassDocumentValidationscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#SetBypassDocumentValidation().(bypass bool) *BulkWriteOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions# { |
| 61 | b.BypassDocumentValidationscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#BypassDocumentValidation. = &bypass |
| 62 | return b |
| 63 | } |
| 64 | |
| 65 | // SetLet sets the value for the Let field. Let specifies parameters for all update and delete commands in the BulkWrite. |
| 66 | // This option is only valid for MongoDB versions >= 5.0. Older servers will report an error for using this option. |
| 67 | // This must be a document mapping parameter names to values. Values must be constant or closed expressions that do not |
| 68 | // reference document fields. Parameters can then be accessed as variables in an aggregate expression context (e.g. "$$var"). |
| 69 | func (b *BulkWriteOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#) SetLetscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#SetLet().(let interface{}) *BulkWriteOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions# { |
| 70 | b.Letscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#Let. = &let |
| 71 | return b |
| 72 | } |
| 73 | |
| 74 | // MergeBulkWriteOptions combines the given BulkWriteOptions instances into a single BulkWriteOptions in a last-one-wins |
| 75 | // fashion. |
| 76 | // |
| 77 | // Deprecated: Merging options structs will not be supported in Go Driver 2.0. Users should create a |
| 78 | // single options struct instead. |
| 79 | func MergeBulkWriteOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/MergeBulkWriteOptions().(opts ...*BulkWriteOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#) *BulkWriteOptionsscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions# { |
| 80 | b := BulkWritescip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWrite().() |
| 81 | for _, opt := range opts { |
| 82 | if opt == nil { |
| 83 | continue |
| 84 | } |
| 85 | if opt.Commentscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#Comment. != nil { |
| 86 | b.Commentscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#Comment. = opt.Commentscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#Comment. |
| 87 | } |
| 88 | if opt.Orderedscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#Ordered. != nil { |
| 89 | b.Orderedscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#Ordered. = opt.Orderedscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#Ordered. |
| 90 | } |
| 91 | if opt.BypassDocumentValidationscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#BypassDocumentValidation. != nil { |
| 92 | b.BypassDocumentValidationscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#BypassDocumentValidation. = opt.BypassDocumentValidationscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#BypassDocumentValidation. |
| 93 | } |
| 94 | if opt.Letscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#Let. != nil { |
| 95 | b.Letscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#Let. = opt.Letscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#Let. |
| 96 | } |
| 97 | if opt.BypassEmptyTsReplacementscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#BypassEmptyTsReplacement. != nil { |
| 98 | b.BypassEmptyTsReplacementscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#BypassEmptyTsReplacement. = opt.BypassEmptyTsReplacementscip-go gomod go.mongodb.org/mongo-driver . `go.mongodb.org/mongo-driver/mongo/options`/BulkWriteOptions#BypassEmptyTsReplacement. |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | return b |
| 103 | } |