Not overriden dict methods are breaking Document class logic in regards to keep _id key in sync with _document_id class property. As this breaks my work I'm currently implementing a fix and to me the most sensible way is to completely remove this feature, using _id property when needed.
If I correctly understand the code, this is only used in cloudant.document module and that logic seems completely removable. What do you think? TIA
1. Steps to reproduce and the simplest code sample possible to demonstrate the issue
As you can see, using __setitem__ correctly produce a new document with an url coherent with doc._id. Using update instead make a new revision on an doc._id mismatching url.
2. What you expected to happen
Every dict updating methods (so also pop, popitem, clear, setdefault) should work the same way as setitem/delitem dunders.
Removing _document_id logic and staying DRY on _id works, tests passes and now every dict manipulation is inherently supported. I'd like to know what do you think! :)
Bug Description
Not overriden dict methods are breaking Document class logic in regards to keep
_id
key in sync with_document_id
class property. As this breaks my work I'm currently implementing a fix and to me the most sensible way is to completely remove this feature, using_id
property when needed.If I correctly understand the code, this is only used in cloudant.document module and that logic seems completely removable. What do you think? TIA
1. Steps to reproduce and the simplest code sample possible to demonstrate the issue
In this example:
produce this output:
As you can see, using
__setitem__
correctly produce a new document with an url coherent withdoc._id
. Usingupdate
instead make a new revision on andoc._id
mismatching url.2. What you expected to happen
Every dict updating methods (so also
pop
,popitem
,clear
,setdefault
) should work the same way as setitem/delitem dunders.3. What actually happened
Only setitem/delitem keeps ids in sync