Get document update structure
Forms data structure for updating documents
- Parameters
- Advanced call ?
Function GetDocumentUpdateStructure(Val Filter, Val Data, Val UpdateAll = True, Val Insert = False, Val Collation = Undefined) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| Filter | --query | Structure Of KeyAndValue | ✔ | Document filter |
| Data | --data | Structure Of KeyAndValue | ✔ | New document data for update |
| UpdateAll | --multi | Boolean | ✖ | True > updates all documents by filter, False > only one |
| Insert | --upsert | Boolean | ✖ | Insert a new document if no document was found |
| Collation | --cltn | Structure Of KeyAndValue | ✖ | Special field comparison rules |
Returns
Structure Of KeyAndValue - Result of connection termination
| Parameter | Description |
|---|---|
| dontwait | Creates a background job and returns its data (for 1C and OneScript only) |
1C:Enterprise/OneScript code example
// __4 = $
Filter = New Structure("stringField,doubleField", "Text", New Structure("__4gte, __4lte", 100, 150));
Data = New Structure( "__4set", New Structure("doubleField", 999));
Result = OPI_MongoDB.GetDocumentUpdateStructure(Filter, Data, True, True);
- Bash
- CMD/Bat
# JSON data can also be passed as a path to a .json file
oint mongodb GetDocumentUpdateStructure \
--query "{'stringField':'Text','doubleField':{'__4gte':'100','__4lte':'150'}}" \
--data "{'__4set':{'doubleField':'999'}}" \
--multi true \
--upsert true
:: JSON data can also be passed as a path to a .json file
oint mongodb GetDocumentUpdateStructure ^
--query "{'stringField':'Text','doubleField':{'__4gte':'100','__4lte':'150'}}" ^
--data "{'__4set':{'doubleField':'999'}}" ^
--multi true ^
--upsert true
Result
{
"q": {
"stringField": "Text",
"doubleField": {
"__4gte": 100,
"__4lte": 150
}
},
"u": {
"__4set": {
"doubleField": 999
}
},
"multi": true,
"upsert": true
}