ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / Managing databases / Big Data / Managing Mongo files
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
mongoOperationUpdateAll (Type of variable)
In french: mongoOpérationModificationTout
The mongoOperationUpdateAll type is used to define all the advanced characteristics of a document update operation that will be added to a bulk operations list. All the documents that match the selection filter will be updated. The characteristics of this operation can be defined and changed using different WLanguage properties.
To be executed, this update operation will have to be added to the array of operations handled by MongoExecuteOperations.
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
MongoCreateCollection(base, "col1",optCol)
col is mongoCollection = base..Collection["col1"]
 
MongoDeleteAll(col,"{}")
MongoAdd(col, "{""item1"":""A"",""item2"":1}")
MongoAdd(col, "{""item1"":""a"",""item2"":2}")
MongoAdd(col, "{""item1"":3,""item2"":1}")
MongoAdd(col, "{""item1"":3,""item2"":2}")
MongoAdd(col, "{""item1"":4,""item2"":1}")
MongoAdd(col, "{""item1"":4,""item2"":2}")
MongoAdd(col, "{""item1"":5,""item2"":1}")
MongoAdd(col, "{""item1"":5,""item2"":2}")
MongoAdd(col, "{""item1"":6,""item2"":1}")
 
t is array of dynamic mongoOpération
 
opAdd is mongoOperationAdd
opAdd.Document = "{""item1"":1,""item2"":1}"
t.Add(opAdd)
 
opDeleteOne is mongoOperationDeleteOne
opDeleteOne.Filter = "{""item1"":""a""}"
opDeleteOne.Option = [
{
"collation":
{
"locale":"en_US",
"caseFirst": "lower"
}
}
]
t.Add(opDeleteOne)
 
opDeleteAll is mongoOperationDeleteAll
opDeleteAll.Filter = "{""item1"":3}"
t.Add(opDeleteAll)
 
opUpdateOne is mongoOperationUpdateOne
opUpdateOne.Filter = "{""item1"":4}"
opUpdateOne.Update = "{ ""$inc"": {""item2"":10}}"
t.Add(opUpdateOne)
 
opUpdateAll is mongoOperationUpdateAll
opUpdateAll.Filter = "{""item1"":5}"
opUpdateAll.Update = "{ ""$inc"": {""item2"":20}}"
t.Add(opUpdateAll)
 
opReplace is mongoOperationReplaceOne
opReplace.Filter = "{""item1"":6}"
opReplace.Document = "{""item1"":6,""item2"":42}"
t.Add(opReplace)
 
 
let ret = MongoExecuteOperations(col, t)
 
opt is mongoOperationsOption
opt.Comment = "My operation"
opt.Ordered = False
 
optWrite is mongoWriteConcern
optWrite.Mode = mwcMajority
 
t.DeleteAll()
opdd.Document = "{""item1"":10}"
t.Add(opAdd)
ret = MongoExecuteOperations(col, t)
dbgAssert(ErrorOccurred = True)
 
opt.BypassDocumentValidation = True
ret = MongoExecuteOperations(col, t, opt, optWrite)
dbgAssert(ErrorOccurred = False)
Properties
The following properties can be used to handle mongoOperationUpdateAll variables:
Property nameType usedEffect
FilterType corresponding to the filter usedDescription of the MongoDB filter(s) that will be applied to select the document to update. This filter corresponds to:
  • a JSON document, in string format.
  • a BSON document, in buffer format.
  • a variant.
OptionType of the format usedUpdate options. These options correspond to:
  • a JSON document, in string format.
  • a BSON document, in buffer format.
  • a variant.
For more details on these options, see the Mongo documentation.
UpdateType of the format usedDescription of the modifications that will be performed in the document that matches the filter. Corresponds to:
  • a JSON document, in string format.
  • a BSON document, in buffer format.
  • a variant.
Minimum version required
  • Version 28
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/29/2023

Send a report | Local help