lanto03 / couchdb-python

Automatically exported from code.google.com/p/couchdb-python
Other
0 stars 0 forks source link

client.Document vs schema.Document #40

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

This is not an issue but a question. I could not find a discussion group or
a mailing list, please direct me if this isn't the appropriate forum.

I'm trying to understand how to use client.Document and schema.Document
objects in couchdb-python. For my use I don't need to map JSON documents to
python objects. However, I'm finding it cumbersome to convert responses
from the database to schema.Document objects in order to have access to
general purpose methods such as load, store and items. The similar names
also complicates keeping track of the class of an object. 

Original issue reported on code.google.com by kochhar...@gmail.com on 4 Dec 2008 at 1:40

GoogleCodeExporter commented 8 years ago
About the similar naming see issue 13.

If you don't need mapping to Python objects, you don't need couchdb.schema.

The load() and store() functions are just convenience functions for mapped 
objects. The basic functionality of 
loading and storing documents is available in couchdb.client.Database class 
(__getitem__ and __setitem__, 
basically). A couchdb.client.Document is basically just a dictionary, so it 
provides an items() method and 
everything else you find on regular Python dicts.

Original comment by cmlenz on 2 Jul 2009 at 1:22