From f0cb60483cab30ec1704c98a9c998167defbb24a Mon Sep 17 00:00:00 2001 From: behackett Date: Fri, 27 May 2011 13:06:14 -0700 Subject: [PATCH] Clarify int/long encode/decode behavior PYTHON-247 --- bson/son.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bson/son.py b/bson/son.py index cc3c66758..efbac6b01 100644 --- a/bson/son.py +++ b/bson/son.py @@ -35,7 +35,8 @@ class SON(dict): =================================== ============= =================== None null both bool boolean both - int number (int) both + int [#int]_ int32 / int64 py -> bson + long int64 both float number (real) both string string py -> bson unicode string both @@ -56,6 +57,9 @@ class SON(dict): `bson.binary.Binary`. Otherwise it will be saved as a BSON string and retrieved as unicode. + .. [#int] A Python int will be saved as a BSON int32 or BSON int64 depending + on its size. A BSON int32 will always decode to a Python int. A BSON int64 + will always decode to a Python long. .. [#dt] datetime.datetime instances will be rounded to the nearest millisecond when saved .. [#dt2] all datetime.datetime instances are treated as *naive*. clients