Features:
- Add fields list to
Document
andEmbeddedDocument.__dir__()
(see #367).
Bug fixes:
- Test database by comparing to
None
, not casting tobool
to prevent an exception raised by pymongo >= 4 (see #366).
Bug fixes:
- Fix ListField.insert: trigger
set_modified
, deserialize using inner field (see #364).
Features:
- Fix internationalization of generated marshmallow fields for container fields (DictField, ListField, NestedField) (see #329).
- Don't pass field metadata as kwargs (deprecated in marshmallow 3.10.0) but as
metadata
argument (see #328).
Bug fixes:
- Fix IO validation of None for references, lists and embedded documents (see #330).
- Add _dict_io_validate to propagate IO validation through DictField (see #335).
Other changes:
- Backwards-incompatible: Require marshmallow>=3.10.0 (see #328).
Features:
- Provide
Instance
subclasses for each framework to help users migrating a database from umongo 2 to umongo 3 (see #319). - Backwards-incompatible: Postpone embedded document resolution in
EmbeddedField
to allow passing an embedded document as string before its registration. Unknown embedded document errors inEmbeddedField
are now detected at runtime, not registration time. Also, indexes are now collected on first use rather than upon registration and should be accesses throughDocument.indexes
cached property rather thanDocument.opts.indexes
. (see #322) - Backwards-incompatible: Make
BaseSchema
ordered. This fixes querying on embedded documents. MakeBaseMarshmallowSchema
ordered as well. (see #323) - Backwards-incompatible: Make
RemoveMissingSchema
opt-out. By default, generated pure marshmallow schemas now skip missing values fromDocument
instances rather that returningNone
. This can be changed by settingMA_BASE_SCHEMA_CLS
. (see #325)
Bug fixes:
- Fix a bug introduced in 3.0.0b12 preventing instance initialization with DB
as parameter as in
instance = PyMongoInstance(db)
. (see #318)
Features:
- Backwards-incompatible: Rework
Instance
: mergeBaseInstance
,Instance
andLazyLoaderInstance
into a single abstractInstance
class. Removetemplates
argument fromInstance
. RenameInstance.init
toInstance.set_db
. Don't republish concrete framework instances inumongo
top module. (see #314) - Add
session
context manager toPyMongoInstance
andMotorAsyncIOInstance
. This allows to use session related features (causally consistent reads, transactions) from umongo. (see #315)
Features:
- Backwards-incompatible: Allow setting arbitrary attributes on
Document
andEmbeddedDocument
instances. This change is part of a refactor meant to simplify set / get / delete operations on document objets and (marginally) improve performance. (see #272) - Use structured information provided with
DuplicateKeyError
rather than parse the error message string (see #309). - Add
replace
argument tocommit
method to force writing the whole document rather than updating (see #310).
Other changes:
- Support Python 3.9 (see #311).
- Backwards-incompatible: Drop motor<2.0.0 support (see #312).
- Backwards-incompatible: Drop MongoDB<4.2 support (see #313).
Features:
- Allow passing
Document
andEmbeddedDocument
in queries. (see #303)
Features:
- Add support for motor 2.2 (see #294). (Picked from 2.3.0.)
- Backwards-incompatible: Add
ExposeMissing
context manager to returnmissing
rather thanNone
when dumping. ReplaceFromUmongoSchema
withRemoveMissingSchema
. This schema removes missing fields when dumping by usingExposeMissing
internally. Make this feature opt-in by requiring the user to specifyRemoveMissingSchema
asMA_BASE_SCHEMA_CLS
. (see #261) - Backwards-incompatible: Remove
mongo_world
parameter fromSchema.as_marshmallow_schema
. Schemas generated by this method are meant to (de)serialize umongo objects, notdict
straight from database. (see #299) - Backwards-incompatible: Remove
umongo.Schema
. Schemas should inherit fromumongo.abstract.BaseSchema
. ExposeRemoveMissingSchema
asumongo.RemoveMissingSchema
. (see #301)
Other changes:
- Backwards-incompatible: Drop Python 3.6 support (see #298).
Features:
- Let
Document
inherit fromEmbeddedDocument
(see #266). - Add
MixinDocument
allowingDocument
andEmbeddedDocument
to inherit fields and pre/post methods from mixin objects (see #278). - Backwards-incompatible: Remove
as_attribute
argument ofBaseInstance.register
method. Documents can not be accessed by name as instance attributes anymore. (see #290)
Bug fixes:
- Fix passing
None
to a field with_required_validate
method (see #289).
Features:
- Backwards-incompatible: Revert broken feature introduced in 3.0.0b6 allowing to get fields from mixin classes (see #273).
- Backwards-incompatible: Remove
allow_inheritance
option. AnyDocument
orEmbeddedDocument
may be subclassed (see #270). - Backwards-incompatible:
Field
raisesDocumentDefinitionError
rather thanRuntimeError
when passedmissing
kwarg andDocument.commit
raisesNotCreatedError
when passedconditions
for a document that is not in database (see #275).
Features:
- Backwards-incompatible:
abstract
inEmbeddedDocument
behaves consistently withDocument
. The_cls
/cls
field is only added on concrete embedded documents subclassing concrete embedded documents. AndEmbeddedField
only accepts concrete embedded documents. (see #86) Document
andEmbeddedDocument
may inherits from mixin classes. The mixin class should appear first (leftmost) in the bases:class MyDocument(MyMixin, Document)
. (see #188)
Other changes:
- Backwards-incompatible: marshmallow imports throughout the code are done as
import marshmallow as ma
. For convenience,missing
andValidationError
can still be imported asumongo.missing
andumongo.ValidationError
.
Features:
- Backwards-incompatible: Add
MA_BASE_SCHEMA_CLS
class attribute toDocument
andEmbeddedDocument
to specify a base class to use inas_marshmallow_schema
. Drop thecheck_unknown_fields
,params
andmeta
attributes ofas_marshmallow_schema
. Makemongo_world
kwarg-only. The same effect can be achieved using base schema classes. This incidentally fixes brokenas_marshmallow_schema
cache feature. (see #263) - Backwards-incompatible: Add
TxMongoDocument.find_with_cursor
and drop support for upstream deprecatedfind(cursor=True)
. (see #259).
Other changes:
- Backwards-incompatible: Require txmongo>=19.2.0 (see #259).
Features:
- Backwards-incompatible: Remove partial load feature (see #256).
- Backwards-incompatible: Add
Document.pk_field
and removeBaseDataProxy.*_by_mongo_name methods
(see #257). - Backwards-incompatible: Raise AlreadyCreatedError when modifying pk of created document (see #258).
Features:
- Backwards-incompatible: Replace
ReferenceError
withNoneReferenceError
. Review the list of exceptions importable from rootumongo
module. (see #251)
Bug fixes:
- Don't modify data when calling
set_by_mongo_name
on a field that was not loaded in a partial load. (see #253)
Other changes:
- Backwards-incompatible: Drop Python 3.5 support (see #248).
Features:
- Use fields for keys/values in DictField (see #245).
Bug fixes:
- Fix BaseField.__repr__ (see #247).
Features:
- Support marshmallow 3 (see #154).
- All field parameters beginning with
"marshmallow_"
are passed to the marshmallow schema, rather than only a given list of known parameters. (see #228)
Other changes:
- Backwards-incompatible: Drop support for marshmallow 2. See marshmallow upgrading guide for a comprehensive list of changes. (see #154)
- Backwards-incompatible:
StrictDateTimeField
is removed as marshmallow now providesNaiveDateTimeField
andAwareDateTimeField
. (see #154) - Backwards-incompatible:
default
shall now be provided in deserialized form. (see #154)
Features:
- Add support for motor 2.2 (see #294).
Bug fixes:
- Fix
find
/find_one
: passfilter
as first positional argument (see #215).
Other changes:
- Support Python 3.8 (see #210).
Bug fixes:
- Fix
ObjectId
bonus field: catchTypeError
when deserializing (see #207).
Features:
- Add support for motor 2.+ by adding a
count_documents
class method to theMotorAsyncIODocument
class.count_documents
attempts to transparently use the correct motor call signature depending on which version of the driver is installed. Note that the behavior of the cursor object returned byMotorAsyncIODocument.find
strictly adheres to the interface provided by the underlying driver.
Bug fixes:
- Ensure
Reference
andGenericReference
fields round-trip (see #200).
Bug fixes:
- Include modified
BaseDataObject
inBaseDataProxy.get_modified_fields
andBaseDataProxy.get_modified_fields_by_mongo_name
(see #195). - Always return a boolean in
List.is_modified
(see #195). List
: callset_modified
when deleting an element using thedel
builtin (see #195).
Bug fixes:
- Fix millisecond overflow when milliseconds round to 1s in
StrictDateTimeField
(see #189).
Bug fixes:
- Fix millisecond overflow when milliseconds round to 1s in
DateTimeField
andLocalDateTimeField
(see #189).
Bug fixes:
- Fix deserialization of
EmbeddedDocument
containing fields overriding_deserialize_from_mongo
(see #186).
Features:
- Backwards-incompatible:
missing
attribute is no longer used in umongo fields, onlydefault
is used.marshmallow_missing
andmarshmallow_default
attribute can be used to overwrite the value to use in the pure marshmallow field returned byas_marshmallow_field
method (see #36 and #107). - Backwards-incompatible:
as_marshmallow_field
does not passload_from
,dump_to
andattribute
to the pure marshmallow field anymore. It only passesvalidate
,required
,allow_none
,dump_only
,load_only
anderror_messages
, as well asdefault
andmissing
values inferred from umongo'sdefault
. Parameters prefixed withmarshmallow_
in the umongo field are passed to the pure marshmallow field and override their non-prefixed counterpart. (see #170) - Backwards-incompatible:
DictField
andListField
don't default to emptyDict
/List
. To keep old behaviour, passdict
/list
as default. (see #105) - Backwards-incompatible: Serialize empty
Dict
/List
as empty rather than missing (see #105). - Round datetimes to millisecond precision in
DateTimeField
,LocalDateTimeField
andStrictDateTimeField
to keep consistency between object and database representation (see #172 and #175). - Add
DateField
(see #178).
Bug fixes:
- Fix passing a default value to a
DictField
/ListField
as a raw Pythondict
/list
(see #78). - The
default
parameter of a Field is deserialized and validated (see #174).
Other changes:
- Support Python 3.7 (see #181).
- Backwards-incompatible: Drop Python 3.4 support (see #176) and only use async/await coroutine style in asyncio framework (see #179).
- Add
Schema
cache toas_marshmallow_schema
(see #165). - Add
DecimalField
. This field only works on MongoDB 3.4+. (see #162)
- Fix bug when filtering by id in a Document subclass find query (see #145).
- Fix __getattr__ to allow copying and deepcopying Document and EmbeddedDocument (see #157).
- Add Document.clone() method (see #158).
- Raise
UnknownFieldInDBError
when an unknown field is found in database and not usingBaseNonStrictDataProxy
(see #121) - Fix (non fatal) crash in garbage collector when using
WrappedCursor
with mongomock - Depend on pymongo 3.7+ (see #149)
- Pass
as_marshmallow_schema params
to nested schemas. Since this change, every field'sas_marshmallow_schema
method should expect unknown**kwargs
(see #101). - Pass params to container field in
ListField.as_marshmallow_schema
(see #150) - Add
meta
kwarg toas_marshmallow_schema
to pass adict
of attributes for the schema'sMeta
class (see #151)
- Add strict option to (Embedded)DocumentOpts to allow loading of document with unknown fields from mongo (see #115)
- Fix fields serialization/deserialization when allow_none is True (see #69)
- Fix ReferenceFild assignment from another ReferenceField (see #110)
- Fix deletion of field proxied by a property (see #109)
- Fix StrictDateTime bonus field: _deserialize does not accept datetime.datetime instances (see #106)
- Add force_reload param to Reference.fetch (see #96)
- Fix bug in mashmallow tag handling (see #90)
- Fix allow none in DataProxy.set (see #89)
- Support motor 1.1 (see #87)
- Fix deserialization error with nested EmbeddedDocuments (see #84, #67)
- Add
abstract
andallow_inheritance
options to EmbeddedDocument - Remove buggy
as_marshmallow_schema
's parametermissing_accessor
(see #73, #74)
- Replace
Document.opts.children
byoffspring
and fix grand child inheritance issue (see #66) - Fix dependency since release of motor 1.0 with breaking API
- data_objects
Dict
andList
inherit builtinsdict
andlist
- Document&EmbeddedDocument store fields passed during initialization as modified (see #50)
- Required field inside embedded document are handled correctly (see #61)
- Document support marshmallow's pre/post processors
- Add pre/post update/insert/delete hooks (see #22)
- Provide Umongo to Marshmallow schema/field conversion with schema.as_marshmallow_schema() and field.as_marshmallow_field() (see #34)
- List and Dict inherit from collections's UserList and UserDict instead of builtins types (needed due to metaprogramming conflict otherwise)
- DeleteError and UpdateError returns the driver result object instead of the raw error dict (except for motor which only has raw error dict)
- Queries can now be expressed with the document's fields name instead of the name in database
EmbeddedDocument
also need to be registered by and instance before use
- Replace
Document.created
byis_created
(see #14)
- Heavy rewrite of the project, lost of API breakage
- Documents are now first defined as templates then implemented inside an Instance
- DALs has been replaced by frameworks implementations of Builder
- Fix
__getitem__
for Pymongo.Cursor wrapper - Add
conditions
argument to Document.commit - Add
count
method to txmongo
- Fix setup.py style preventing release of version 0.7.7
- Fix await error with Reference.fetch
- Pymongo is now only installed with extra flavours of umongo
- Use extras_require to install driver along with umongo
- Fixing await (Python >= 3.5) support for motor-asyncio
- Fix missing package in setup.py
- Fix setup.py style preventing from release
- Fix crash when generating indexes on EmbeddedDocument
- Fix setup.py not to install tests package
- Pass status to Beta
- Add i18n support
- Add MongoMock support
- Documentation has been a lot extended
- Add
<dal>_lazy_loader
to configure Document's lazy_collection
- Heavy improvements everywhere !
- First release on PyPI.