db.test.insert({'artist': 'xxx', 'count':1});
On Sunday, 11 October 2015 08:17:24 UTC+11, mithril wrote:
db.test.insert({'artist': 'xxx', 'count':1});
always insert 'count' as float
Hi,
JavaScript only has a single numeric type (Number) which is always a 64-bit floating point value.
The mongo shell has helper functions NumberInt() and NumberLong() to allow you to work with 32-bit and 64-bit integers respectively:
db.test.insert({'artist': 'xxx', 'count': NumberInt(1)});
db.test.insert({'artist': 'xxx', 'count': NumberLong(1)});
See Data Types in the mongo Shell in the MongoDB manual for more information.
Regards,
Stephen