Closed vvasuki closed 7 years ago
Agreed. I've found the caching implementation to be somewhat confusing at times. It's easy to be misled into thinking your local object is always a true representation of what's on the server.
You're better off using the doc.exists()
method than relying on __contains__
as this presently only checks against document ids that have been cached.
This is closely related to #116. The proposed idea is that you'd set a remote
parameter when constructing any client or database objects. If remote=False
then the local cache is used and visa versa.
Lets use #116 to track this work. I'll add some further notes there and close this one out.
Thanks for your feedback. It's very much appreciated.
Consider the following snippet (where
id=u'37c1d704a01a462c8a77d9d4e53d4b11'
and doc is retrieved from the database):It yields:
So, database, which sometimes acts like a dict, yields a misleading result when one one does
some_id in some_db
. This suggests an improvement in the interface, or a prominent warning in the docs.