Linux Today: Linux News On Internet Time.





More on LinuxToday


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

Oct 14, 2010, 18:03 (0 Talkback[s])
(Other stories by Akkana Peck)

WEBINAR: On-demand webcast

How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >

"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

Related Stories: