MongoDB
Retrieve
1 samples, from the least code that works to complete workflows.
What a read does
| Rule | On MongoDB |
|---|---|
| One record | By id, or by a key or fields; not found is null; several matches are ARX2003 |
| Lookups | A declared lookup reads back as an ArxEntityReference with the referenced record's display name |
| Field names | Case-sensitive in MongoDB: a field the catalog declares is read and written with its declared spelling whatever the attribute's case; an undeclared field by its exact spelling (Name and name are two fields) |
| Functions and Execute | Not offered: MongoDB has no stored procedures or functions that return rows (ARX8001) |
Reference
Value types read back
| Stored as | Read back as |
|---|---|
| string | string |
| 32-bit integer | int |
| 64-bit integer | long |
| double | double |
| Decimal128 | decimal (ARX4001 past .NET's range) |
| boolean | bool |
| date | DateTime, UTC (a DateOnly is stored as midnight UTC: read it with GetAttributeValue<DateOnly>, which converts a midnight DateTime from 0.1.0-preview.5, or preload the field) |
| ObjectId | string (24 hexadecimal characters) |
| binary subtype 4 | Guid |
| other binary | byte[] |
| embedded document | ArxJsonB |
| array of one kind of value | a typed array (string[], int[], …); any other array as ArxJsonB |
| a declared lookup | ArxEntityReference |
| a preloaded field | the preloaded type (DateOnly from a date, TimeOnly from text, …) |
Aggregates
| Aggregate | On MongoDB | Reads back as |
|---|---|---|
| Count, CountBig, CountDistinct, CountBigDistinct | $sum of 1 (or of the documents where the field is set), $addToSet then its size, as a 64-bit integer |
long |
| Sum | $sum: of 32-bit integers, a 32-bit integer while it fits and a 64-bit one past it; of doubles, a double; of Decimal128, a Decimal128. A field no document has sums to 0 |
int, long, double or decimal |
| Avg | $avg: a double (a Decimal128 for Decimal128 values) |
double or decimal |
| Min, Max | $min, $max |
the field's type |