---

Snakes on a Couch! Using Python with CouchDB, Part II– Where do you want to eat?

“How often do you stand around with your friends asking “Where
do you want to eat?” “I dunno, where do you want to eat?” “I
dunno.”

“Wouldn’t it be handy if you had a program to suggest a place
you haven’t been to in a while?

“From Part 1, you already had a view that sorts restaurant by
date:

date_mapfn = """function(doc)
{
  if (doc.type == 'restaurant') {
    emit(doc.last_visited, doc.name);
  }
}"""



"In Python, retrieve the restaurants in that view like this:
import couchdb
server = couchdb.client.Server('http://localhost:5984/')
db = server['restaurants']


Complete
Story

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends, & analysis