Filtering does not work on large numbers

cloud

#1

We’ve come across a problem where large number used in filtering do not work. We are using Realm in ReactNative, but the problem can be seen from Realm Studio as well. Please consider the following tablw ith two entries, one with a 13 digit key, another with a 18 digit key.


The smaller one will be found while filtering

The larger one will not


#2

Hmm, the larger one still in the integer max?


#3

From the documentation https://realm.io/docs/javascript/latest/
“int, float, and double properties map to JavaScript number values. Internally ‘int’ and ‘double’ are stored as 64 bits while float is stored with 32 bits.”
So int should be able to store up to https://en.wikipedia.org/wiki/9,223,372,036,854,775,807
But now that i’m looking into this, maybe it should not exceed JS max safe int https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER which is 9007199254740991 ?
If so, it probably should be worth noting this in the documentation…


#4

I’m just guessing here :slight_smile:
It seems that the storing is okay, the query parameter has a type issue.


#5

I’m not sure what you mean by type issue. That could be the case if I was seeing this behavior only in my JS code. But this is also a problem in Realm Studio… Or are you saying it is a bug with Realm? :slight_smile: