Scille / umongo

sync/async MongoDB ODM, yes.
MIT License
446 stars 63 forks source link

How to ignore fileds that unuseful in the document model but exist in mongo collection #358

Closed luckystar1992 closed 3 years ago

luckystar1992 commented 3 years ago

In my Mongodb, there are 4 columns in a collection. And in the umongo Document defination, I only want to 2 fields (the first two columns in mongo), and an UnknownFieldInDBError: would be raised in the runtime. If there any way that can solve this problem?

lafrech commented 3 years ago

You may want to consider setting strict option to False: https://umongo.readthedocs.io/en/latest/apireference.html?highlight=strict#umongo.document.DocumentOpts.

luckystar1992 commented 3 years ago

@lafrech Thanks a lot, it works.