Is it OK to mixed NumberLong and normal integers in the same field in MongoDB?
- by Nicholas Tolley Cottrell
I have been using Morphia to persistent objects from Java. I have also been running some batch processes from the console. I just realised that some values are now stored as NumberLong and number as plain Javascript numbers.
I have an index on this field. Everything seems to be ok, but if I query: {f: 100}
from the console it still returns the object even if it actually contains {f: NumberLong(100)}
Is this true of all the drivers? It is best practice to avoid NumberLong is I can fit the value inside 32-bit? Will I save a lot of data and index space if I convert all NumberLongs to basic numbers?