Created
August 23, 2012 08:30
-
-
Save sidharthshah/3434268 to your computer and use it in GitHub Desktop.
Updating CouchDB's doc with additional field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import couchdb | |
>>> couch = couchdb.Server() | |
>>> db = couch['catalog_users'] | |
>>> doc = db['f893955fc22b7ff25fd5d3764a009354'] | |
>>> doc | |
<Document 'f893955fc22b7ff25fd5d3764a009354'@'19-ea4b426d433b779ff9ed8267b989714e' {'home_zipcode': '', 'city': '', 'fb_user_id': '', 'zipcode': '', 'state': '', 'type': 'Publisher', 'email': 'iamsidd@gmail.com', 'media_url': '', 'status': 'active', 'bio': '', 'couchrest-type': 'Publisher', 'passwd': '97032c0a89cba64bd10f7d221c589f60', 'address1': '', 'address2': '', 'auth': '59b58778-eb69-11e0-9bea-1231390b25d1', 'dob': '', 'key': '59b58778-eb69-11e0-9bea-1231390b25d1', 'super_publisher_id': 'a36c91061da18c0c1ba1c3412409d8aa', 'created_ts': 1338361447, 'name': '', 'access_token': '', 'gender': '', 'publisher_revenue': 0.5, 'customer_type': 'storyteller', 'stories': ['273374'], 'updated_ts': 1338361470, 'published': True}> | |
>>> doc['internal_rating'] = 4 | |
>>> db.save(doc) | |
('f893955fc22b7ff25fd5d3764a009354', '20-f5c36653f45f853570f3399793ea560f') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment