Porting from jquery.couch.js.