janmonschke / backbone-couchdb

A couchdb connector for backbone with support for real time changes.

Home Page:http://janmonschke.com/projects/backbone-couchdb.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Uncaught TypeError: undefined is not a function

neverender opened this issue · comments

I get the following error in the Chrome console when trying to read:

backbone-couchdb.js:79 Uncaught TypeError: undefined is not a function

What version of Backbone are you using?

I was using v0.3.1 but I just updated to v0.3.3 and there's no change. Also, fyi, the error was originally on line 77. I added a couple lines to backbone-chouchdb.js while trying to figure out the problem.

edit: oops I accidentally closed this issue. Didn't mean to...

Could it be that your error is related to this change?
https://github.com/jasondavies/backbone-couchdb/commit/a886e7d5188486e53b35094d72e13ef9f5fd7f30

backbone-couchdb is using the newest HEAD version of backbone.

Yeah looks like it. No more error with the latest backbone. I'm still not getting any data when doing a fetch on a collection though. Create works. And it shows up in couchdb. But fetch shows 0 models.

My code works without backbone-couchdb and I've taken a look at your example app and I think I've done things right...

What does CouchDB return? You can look up the result for each XHR request in the Inspector.

{"total_rows":7,"offset":7,"rows":[],"update_seq":317}

When I go to the request url in another tab, the offset is 0 and there are 7 objects in the 'rows' array. So it looks like the offset is 7 when I want to it be 0. Is that something I can do or is it a bug?

Seems like something is wrong in your couchdb view or the url of the collection.

Oh hey. You're right. Typo in my view. Thanks a lot, it's working fine now.