Can mongo_world=True work with missing_accessor=True?
See original GitHub issueAFAIU, in as_marshmallow_schema
, one can pass
missing_accessor=True, mongo_world=True
But it is bound to fail, because schema_from_umongo_get_attribute
expects obj
to be an object, not a dict
.
def schema_from_umongo_get_attribute(self, attr, obj, default):
ret = MaSchema.get_attribute(self, attr, obj, default)
if ret is None and ret is not default and attr in obj.schema.fields:
raw_ret = obj._data.get(attr)
return default if raw_ret is missing else raw_ret
else:
return ret
Shouldn’t this be prevented? Like, by setting missing_accessor
to False
when mongo_world is True
?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Query for boolean field as "not true" (e.g. either false or non ...
This query can use an index on {deleted: 1} in the current 2.6.6 MongoDB release. Share.
Read more >Write Concern — MongoDB Manual
If j: true , requests acknowledgment that the mongod instances, as specified in the w: <value>, have written to the on-disk journal. j:...
Read more >The Real #1, Others can claim it. We prove it!
Whether you're on the shooting line or in a tree stand, you can be confident knowing that your equipment is truly the best...
Read more >Cannot connect to mongodb while allowInsecureConnection ...
Unfortunately, the NodeJS function example does not work out of the box because of this error either, and I see no concrete solution...
Read more >Features — Eve 2.0.4 documentation
In general you will find that most MongoDB queries “just work”. ... can be enabled or disabled both at global level (by setting...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Mongo world is supposed to always return you the raw data, so there is no need to provide a custom
get_attribute
. Thus Mongo world and OO world should provide the same consistent behavior (i.e.missing
is handled by marshmallow-pure schema)As stated above: it is not broken, it is not needed 😄
Given your summarize, I think we agree
missing_accessor
is doing more harm than good so I pushed a new version removing it. Beside, this feature should work with Mongo world as well as OO world, so open an issue if it’s not the case 👍OK, I get it. Removing it is the right thing to do.
Thanks.