|
|
|
|
|
- Properties specific to mongoOperationsOption variables
mongoOperationsOption (Variable type) In french: mongoLotOpérationsOption
The mongoOperationsOption type is used to define the options of bulk operations. You can define and change the characteristics of these details using different WLanguage properties. Note: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable. MongoCreateCollection(base,"col1",optCol)
col is mongoCollection = base..Collection["col1"]
MongoDeleteAll(col,"{}")
MongoAdd(col, "{""rub1"":""A"",""rub2"":1}")
MongoAdd(col, "{""rub1"":""a"",""rub2"":2}")
MongoAdd(col, "{""rub1"":3,""rub2"":1}")
MongoAdd(col, "{""rub1"":3,""rub2"":2}")
MongoAdd(col, "{""rub1"":4,""rub2"":1}")
MongoAdd(col, "{""rub1"":4,""rub2"":2}")
MongoAdd(col, "{""rub1"":5,""rub2"":1}")
MongoAdd(col, "{""rub1"":5,""rub2"":2}")
MongoAdd(col, "{""rub1"":6,""rub2"":1}")
t is array of mongoOperation dynamic
opAjout is mongoOperationAdd
opAjout.Document = "{""rub1"":1,""rub2"":1}"
t.Add(opAjout)
opSupprimeOne is mongoOperationDeleteOne
opSupprimeOne.Filter = "{""rub1"":""a""}"
opSupprimeOne.Option = [
{
"collation":
{
"locale":"en_US",
"caseFirst": "lower"
}
}
]
t.Add(opSupprimeOne)
opSupprimeTout is mongoOperationDeleteAll
opSupprimeTout.Filter = "{""rub1"":3}"
t.Add(opSupprimeTout)
opModifieOne is mongoOperationUpdateOne
opModifieOne.Filter = "{""rub1"":4}"
opModifieOne.Update = "{ ""$inc"" : {""rub2"":10}}"
t.Add(opModifieOne)
opModifieTout is mongoOperationUpdateAll
opModifieTout.Filter = "{""rub1"":5}"
opModifieTout.Update = "{ ""$inc"" : {""rub2"":20}}"
t.Add(opModifieTout)
opRemplace is mongoOperationReplaceOne
opRemplace.Filter = "{""rub1"":6}"
opRemplace.Document = "{""rub1"":6,""rub2"":42}"
t.Add(opRemplace)
let ret = MongoExecuteOperations(col, t)
opt is mongoOperationsOption
opt.Comment = "Ma belle opération"
opt.Ordered = False
optWrite is mongoWriteConcern
optWrite.Mode = mwcMajority
t.DeleteAll()
opAjout.Document = "{""rub1"":10}"
t.Add(opAjout)
ret = MongoExecuteOperations(col, t)
dbgAssert(ErrorOccurred = True)
opt.BypassDocumentValidation = True
ret = MongoExecuteOperations(col, t, opt, optWrite)
dbgAssert(ErrorOccurred = False)
Properties Properties specific to mongoOperationsOption variables The following properties can be used to handle mongoOperationsOption variables: | | | Property name | Type used | Effect |
---|
Comment | Type corresponding to the expected format | Value with the comment to attach to this command. The comment will appear in the log messages, the profiler output and the "currentOp" output. This comment corresponds to:- a JSON document, in string format.
- a BSON document, in buffer format.
- a variant.
| BypassDocumentValidation | Boolean | - True to ignore the validation of the documents for all the operations,
- False otherwise.
| Let | Format corresponding to the type used | A BSON/JSON/Variant document consisting of any number of parameter names, each followed by definitions of constants in the MQL Aggregate Expression language. | Ordered | Boolean | - True
- False (default) to try to insert all the documents, continuing after the errors.
|
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|