I have an app using MongoDB with Atlas Device Sync to save data our data. In the Android App, I have a data model that looks like this:
open class Model(
// Primary key & irrelevant fields removed
var page: Int? = 0
) : RealmObject() {
...
}
Now, when I save an instance of this object into my DB it will be shown like this (when I query it via the MongoDB Compass app):
{
"_id": {
"$oid": "66544dd873f621105bb7a477"
},
"page": {
"$numberLong": "0"
},
}
Why is the page property saved as a long (Int64) when the Int type for Kotlin is defined as 32 bits? And the Mongo DB Dev Docs also define the Int type as being 32-bit.
The JSON Schema for the Device Sync also defines the property as an Int:
"page": {
"bsonType": "int"
},
I have the same issue with the iOS app written in Swift. But there, I understand it as the Int data type depends on the device architecture and is actually 64 bits, so it makes sense.