Commit Graph

47 Commits

Author SHA1 Message Date
Steven Silvester
087950d869
PYTHON-3164 Outdated link from PyMongo docs to community forum (#895) 2022-03-15 15:49:11 -05:00
Steven Silvester
a0fe7c03af
PYTHON-3120 Set up flake8 linting (#868) 2022-02-17 06:44:08 -06:00
Steven Silvester
5578999a90
PYTHON-1834 Use a code formatter (#852) 2022-02-09 06:44:28 -06:00
Steven Silvester
dd6c140d43
PYTHON-3060 Add typings to pymongo package (#831) 2022-02-02 21:12:36 -06:00
Steven Silvester
52ed5a4135
PYTHON-3052 Add Typings to PyMongo Itself (#829) 2022-01-13 16:09:48 -06:00
Julius Park
eabd2235ba
PYTHON-2859 Add BSON Binary subtype 7 (#763) 2021-10-26 14:24:27 -07:00
Shane Harvey
fb20975a1f
PYTHON-2245 Change default uuidRepresentation to UNSPECIFIED (ie disable UUID encoding by default) (#724)
This change also stops decoding both 3 and 4 subtypes as UUIDs.
With standard, only subtype 4 is decoded to UUID and subtype 3 is decoded to Binary.
With legacy representations, only subtype 3 is decoded to UUID and subtype 4 is decoded to Binary.
2021-09-14 16:48:52 -07:00
Shane Harvey
69c69a6bfb
PYTHON-2862 Remove versionchanged info for PyMongo <3.0 (#709) 2021-08-19 10:39:26 -07:00
Shane Harvey
5fd175c0d8
PYTHON-2529 Remove UUIDLegacy (#698) 2021-08-06 16:52:41 -07:00
Bernie Hackett
c70071df1d PYTHON-2133 Remove Py2 compatibility from bson 2021-01-14 14:57:20 -08:00
Prashant Mital
ff327b3e31
PYTHON-2252 Add examples and documentation for new UUID behavior (#467) 2020-07-29 14:46:48 -07:00
Prashant Mital
4760d07815
PYTHON-2152 Expand native UUID handling support; Implement UUID specification 2020-06-01 17:45:08 -07:00
Bernie Hackett
e92e2b0efb PYTHON-1648 Binary buffer protocol support 2019-07-18 08:41:40 -07:00
Bernie Hackett
2f06e8a441 PYTHON-1808 - Document uuidRepresentation 2019-04-16 16:26:09 -07:00
jakirkham
5950abf323 Clarify that Binary expects data to be bytes (#399) 2019-03-28 11:51:28 -07:00
Petr Messner
7f1939ebcb PYTHON-1642 - Replace count() with count_documents({}) in docs (#376) 2018-09-13 16:34:35 -07:00
Bernie Hackett
507f954ed4 Update copyright dates 2017-12-01 17:23:39 -08:00
Shane Harvey
e775295ab5 PYTHON-1367 Ignore uuid_representation when decoding BSON binary subtype 4. 2017-09-12 17:20:14 -07:00
Luke Lovett
3321b66d34 PYTHON-977 - Fix __hash__ method on BSON types that inherit from Python builtin types.
In Python 2, objects automatically inherit the __hash__ of their parent
class. In Python 3, objects that override __eq__ do not automatically inherit
__hash__, so these objects were not hashable under Python 3.  Additionally,
mutable BSON types and types that overide __eq__ but did not explicitly define
__hash__ had broken __hash__ methods under Python 2.  This commit unifies the
hashing behavior between Python versions and fixes the __hash__ methods such
that two BSON objects hash the same only if they are equal.

N.B.: bson.code.Code and bson.regex.Regex are no longer hashable under Python 2
because they are mutable.
2015-09-04 14:45:24 -07:00
Bernie Hackett
aec685b374 Fix up copyright dates. 2015-03-25 11:55:02 -07:00
Bernie Hackett
839893939e PYTHON-821 - Deprecated legacy API.
This commit deprecates insert, update, save, and remove. Each
now raises DeprecationWarning at stacklevel 2. This change also
updates all tutorials and example documentation to use the new
CRUD API, tests the deprecations, and fixes up a few more tests
that were still using the legacy API.
2015-02-20 15:41:45 -08:00
A. Jesse Jiryu Davis
9da835ab3d PYTHON-825 BSON API changes and internal options handling.
This change resolves four issues:

PYTHON-826 The new codec_options submodule is moved from pymongo to bson.

PYTHON-827 Use codec_options in BSON APIs.

Functions and methods of the bson module that accepted the options as_class,
tz_aware, and uuid_subtype now accept a codec_options parameter instead.

For example, the function definition for bson.decode_all changes from this:

def decode_all(data, as_class=dict, tz_aware=True,
               uuid_subtype=OLD_UUID_SUBTYPE)

to:

def decode_all(data, codec_options=CodecOptions())

The following functions are changed:

- decode_all
- decode_iter
- decode_file_iter

The following methods are changed:

- BSON.encode
- BSON.decode

This is a breaking change for any application that uses the BSON API directly
and changes any of the named parameter defaults. No changes are required for
applications that use the default values for these options. The behavior
remains the same.

PYTHON-828 Internal BSON module changes to support CodecOptions

The pure Python BSON module passes around a CodecOptions instance instead of
as_class, tz_aware, and uuid_subtype. C extensions pass these values around in
a struct.

PYTHON-801 Rename uuid_subtype to uuid_representation.
2015-02-05 23:09:23 -06:00
Bernie Hackett
a3fb2462bb PYTHON-801 - Remove BaseObject.uuid_subtype 2014-12-29 07:34:07 -08:00
Bernie Hackett
7e4ebde147 PYTHON-801 - Add STANDARD and PYTHON_LEGACY to bson.binary
And use them in place of UUID_SUBTYPE and OLD_UUID_SUBTYPE. This
change also cleans up and clarifies the documentation for
JAVA_LEGACY and CSHARP_LEGACY. None of these are binary subtypes,
but instead UUID representations in the Python, C#, and Java drivers.
2014-12-24 09:52:58 -08:00
A. Jesse Jiryu Davis
08dccbba46 Remove ancient version annotations.
Delete "versionchanged" and "versionadded" directives that predate 2.0.
2014-10-31 14:15:24 -04:00
Bernie Hackett
b26459cd6a Remove useless uuid module checks.
These were only needed for python 2.4 which does
not provide a uuid module.
2014-04-24 10:09:21 -07:00
Bernie Hackett
bd8d4a3b10 PYTHON-673 - Use bytes and remove binary_type
The binary_type alias was added to support python
2.4 and 2.5, which we no longer support.
2014-04-23 13:25:00 -07:00
A. Jesse Jiryu Davis
2fa1750b07 Update copyright notices and company name. 2014-01-31 09:36:46 -05:00
behackett
2483775f0b Silence C extension RuntimeWarning PYTHON-569
When encoding a document in C while running in a python sub interpreter
(e.g. mod_wsgi spawning sub interpreters) PyMongo would often have
to reload its cache of pure python types - ObjectId, Timestamp,
UUID, etc. - raising RuntimeWarning in the process. The reason this was
necessary is described in the mod_wsgi documentation here:

https://code.google.com/p/modwsgi/wiki/ApplicationIssues#Multiple_Python_Sub_Interpreters

With workarounds documented here:

http://api.mongodb.org/python/2.6.2/faq.html#does-pymongo-work-with-mod-wsgi

With this commit PyMongo will no longer use cached pure python types
when running in a sub interpreter. Instead it will look up pure python
types as needed (primarily when decoding BSON). This eliminates the
problem described in the mod_wsgi docs and eliminates the need for the
Runtime warning.
2013-09-16 17:24:37 -04:00
Ross Lawley
29b9de45db Added __ne__ for DBRefs PYTHON-440 2012-11-22 11:12:36 +00:00
Bernie Hackett
f812d1babb Support copy of UUIDLegacy 2012-11-19 06:27:59 -08:00
Bernie Hackett
ae3a534dfb Fix pickling of Binary with Python 3.1 PYTHON-422
This works around http://bugs.python.org/issue7382
2012-10-25 09:43:14 -07:00
behackett
dfaadd53e8 Doc updates for PyMongo 2.3 2012-08-16 15:52:14 -07:00
behackett
638bb7fbdc Support Java and C# UUID byte order PYTHON-387 2012-08-15 12:10:26 -07:00
behackett
0ee7170cc2 It's 2012... 2012-04-19 12:40:38 -07:00
behackett
8cde67c330 Update bson module docs and comments for python 3. 2012-03-21 15:37:31 -07:00
behackett
7474f5cde8 Python 3 bson changes PYTHON-84 2012-03-20 13:56:15 -07:00
behackett
0c560a5cc4 Fix a few doc test failures. 2012-02-08 15:30:44 -08:00
Wouter Bolsterlee
bfbe701998 Don't overwrite built-in id() function in example 2012-02-08 15:17:11 -08:00
Bernie Hackett
f3d8b86a26 Minor doc updates. 2011-12-17 18:29:59 -08:00
behackett
eb5959ee95 Default to Binary subtype 3 for UUIDs PYTHON-267 2011-12-06 11:58:43 -08:00
behackett
3c85a98edb Support per-collection UUID subtype PYTHON-267 2011-11-10 18:53:08 -08:00
behackett
8bdb7821a9 Always decode to UUID PYTHON-267 2011-09-14 15:11:58 -07:00
behackett
a88a79f474 Fix minor typos PYTHON-267 2011-09-14 13:58:13 -07:00
behackett
258f81870e Store UUIDs as BSON binary subtype 4 PYTHON-267
The default binary subtype for UUIDs has changed
to 4. You can use bson.binary.UUIDLegacy to query
on UUIDs previously stored as subtype 3. See the
UUIDLegacy docstring for more details.
2011-09-14 13:12:36 -07:00
behackett
3603d05ce1 Switch default Binary subtype from 2 to 0. 2011-08-01 15:33:24 -07:00
Mike Dirolf
9c182809f3 Create a separate bson package PYTHON-60
Many of the pymongo modules have been moved into the bson
package. Aliases for those modules have been added to the pymongo
package, without deprecation warnings for now. Application developers
should begin to use the bson namespace, as deprecation of moved
modules will probably begin in the next release.
2010-09-14 13:52:50 -04:00