Get cursor
Gets a cursor for batch retrieval of collection documents
- Parameters
- Advanced call ?
Function GetCursor(Val Connection, Val Collection, Val Base = Undefined, Val Filter = Undefined, Val Sort = Undefined, Val Parameters = Undefined) Export
| Parameter | CLI option | Type | Required | Description |
|---|---|---|---|---|
| Connection | - | String, Arbitrary | ✔ | Connection or connection string |
| Collection | - | String | ✔ | Collection name |
| Base | - | String | ✖ | Database name. Current database if not specified |
| Filter | - | Structure Of KeyAndValue | ✖ | Document filter |
| Sort | - | Structure Of KeyAndValue | ✖ | Selection sorting |
| Parameters | - | Structure Of KeyAndValue | ✖ | Additional retrieval parameters |
Returns
Map Of KeyAndValue - Operation result
| Parameter | Description |
|---|---|
| addin_mode | Manual selection of external component connection mode (for 1C): Isolated, NotIsolated |
Caution
NOCLI: this method is not available in CLI version
1C:Enterprise/OneScript code example
Address = "127.0.0.1:1234";
Login = "bayselonarrend";
Password = "12we...";
Base = "main";
ConnectionParams = New Structure("authSource", "admin");
ConnectionString = OPI_MongoDB.GenerateConnectionString(Address, , Login, Password, ConnectionParams);
Connection = OPI_MongoDB.CreateConnection(ConnectionString);
Collection = "new_collection";
Filter = New Structure("stringField", "Text");
Sort = New Structure("doubleField", -1);
Parameters = New Structure("limit,batchSize", 2, 1);
Result = OPI_MongoDB.GetCursor(Connection, Collection, Base, Filter, Sort, Parameters);
Result
{
"result": true,
"data": {
"cursor": {
"firstBatch": [
{
"_id": "6a15a6be6edd1cf4d2a504a6",
"stringField": "Text",
"oidField": "63ceed18f71dda7d8cf21e8e",
"jsField": "const result = [1, 2, 3].map(x => x * 2).filter(x => x > 3);",
"symbolField": "Y",
"int32Field": 10,
"int64Field": 1000,
"doubleField": 124.456,
"boolField": true,
"dateField": "2025-11-15T10:55:41Z",
"tsField": "Timestamp(1779803838, 0)",
"regexpField": "/[a-z]+@[a-z]+\\.[a-z]+/i",
"binaryField": {
"__B64_BINARY__": "VGV4dA=="
},
"nullField": null,
"minkeyField": "***",
"maxkeyField": "***",
"docField": {
"code": "const result = 1",
"number": 10
},
"arrayField": [
"A",
"<<MinKey>>"
]
}
],
"id": 3532714966087247162,
"ns": "main.new_collection"
},
"ok": 1
}
}