MongoEngine / mongoengine

A Python Object-Document-Mapper for working with MongoDB
http://mongoengine.org
MIT License
4.24k stars 1.23k forks source link

Confused about the documentation #2844

Open kietheros opened 2 months ago

kietheros commented 2 months ago

I am confused about this line in mongoengine docs

If you use Document and the database contains data that isn’t defined then that data will be stored in the document._data dictionary.

I tested with Document, when loading a document which has a field not defined in schema, mongoengine raises mongoengine.errors.FieldDoesNotExist

bagerard commented 2 months ago

Good catch, it should be "If you use DynamicDocument" instead

kietheros commented 1 month ago

@bagerard As far as I understand, with DynamicDocument, fields that do not exist in the schema still become attributes of the model instance. I think that this sentence wants to mention Document with strict is set to False.