-
Type: Bug
-
Resolution: Done
-
Priority: Trivial - P5
-
Affects Version/s: 3.0.1
-
Component/s: None
-
None
-
Environment:Ubuntu 14.10 64-bit. Python 2.7.3.
-
Minor Change
[context: we are working to transition to pymongo 3 so that we can also upgrade to mongodb 3 so that we can get to WireTiger storage and document level locking.]
When querying documents with pymongo 3.0.1 we are finding that fields with long values are being returned as bson.int64.Int64 instances, while in pymongo 2.7.2 they were returned as longs:
pymongo 2.7.2:
>>> type(table.find_one()['created']) <type 'long'>
pymongo 3.0.1:
>>> type(table.find_one()['created']) <class 'bson.int64.Int64'>
So far we haven't found other data types that exhibit the same behavior:
pymongo 2.7.2:
>>> for k,v in sorted(table.find_one({'_id':'1003abf06db74d2991a23668a3510954'}).items()): ... print k, v, type(v) _id 1003abf06db74d2991a23668a3510954 <type 'unicode'> boolVal True <type 'bool'> created 1430840397664 <type 'long'> dictVal {u'a': 1, u'c': 3, u'b': 2} <type 'dict'> floatVal 10 <type 'int'> intVal 5 <type 'int'> listVal [1, 2, 3] <type 'list'> noneVal None <type 'NoneType'> stringVal abc <type 'unicode'>
pymongo 3.0.1:
_id 1003abf06db74d2991a23668a3510954 <type 'unicode'> boolVal True <type 'bool'> created 1430840397664 <class 'bson.int64.Int64'> dictVal {u'a': 1, u'c': 3, u'b': 2} <type 'dict'> floatVal 10 <type 'int'> intVal 5 <type 'int'> listVal [1, 2, 3] <type 'list'> noneVal None <type 'NoneType'> stringVal abc <type 'unicode'>
We are looking for either confirmation that this is intended behavior (and if so, if there are any workarounds we could implement at the pymongo layer rather than at the application layer) or if it's a bug.
Please let me know if there is any additional info I can provide.
Thanks!
- is related to
-
PYTHON-186 When storing integers, type is selected according to value instead of type
- Closed
-
PYTHON-760 BSONInt64 -> Int64
- Closed
-
PYTHON-707 Add a BSONInt64 type
- Closed