musacivak / rock-php

Automatically exported from code.google.com/p/rock-php
0 stars 0 forks source link

Invalid NumberLong value after insert or update (JSON format) #227

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Insert document in JSON format:
{
   "f1": NumberLong(9223372036854775807),
   "f2": NumberLong(922337203685477580)
}

2. Query the document

Result is:
{
   "_id": ObjectId("507e9c0b8e5013b124000000"),
   "f1": NumberLong(-9223372036854775808),
   "f2": NumberLong(922337203685477632) 
}

instead of

{
   "_id": ObjectId("507e9c0b8e5013b124000000"),
   "f1": NumberLong(9223372036854775807),
   "f2": NumberLong(922337203685477580)
}

If you use array format then all work fine.

Insert (in array format):

array (
  'f1' => new MongoInt64(9223372036854775807),
  'f2' => new MongoInt64(922337203685477580),
)

Result in array format is:
array (
  '_id' => new MongoId("507e9c0b8e5013b124000000"),
  'f1' => new MongoInt64(9223372036854775807),
  'f2' => new MongoInt64(922337203685477580),
)

Result in JSON format is:
{
   "_id": ObjectId("507e9c0b8e5013b124000000"),
   "f1": NumberLong(9223372036854775807),
   "f2": NumberLong(922337203685477580) 
}

RockMongo Version 1.1.2, mongo.native_long = 1

Operation System (CentOS, x86_64)

PHP Version (5.3.16)

php_mongo Version (1.2.7)

MongoDB version (2.0.6)

Original issue reported on code.google.com by d.menshi...@gmail.com on 17 Oct 2012 at 12:04