aaronpowell / db.js

db.js is a wrapper for IndexedDB to make it easier to work against
http://aaronpowell.github.com/db.js/
MIT License
818 stars 142 forks source link

.done / .then is not a function #188

Closed rebootcode closed 6 years ago

rebootcode commented 6 years ago

I am constanly getting an errror .done, .then is not a function.

blog:208 Uncaught TypeError: server.boxro.query(...).only(...).done is not a function
    at Array.<anonymous> (blog:208)
    at Ws.fireConnect (doitws.js:157)
    at WebSocket.Ws.conn.onopen (doitws.js:34)

but when i do without .done, .then, it does return most of the function available like desc, filter

but .done and .then is not working at all.

aaronpowell commented 6 years ago

Are you able to share the code that you're getting the error? I think there might be an error in the documentation, you need to invoke execute to get the Promise to "start" - https://github.com/aaronpowell/db.js/blob/master/tests/specs/query.js#L257-L265

Also the done method no longer exists on the Promise object that's returned since it was migrated to ES2015 Promises rather than jQuery Deferred.

rebootcode commented 6 years ago

I am just trying these code from doc:-

  1. https://github.com/aaronpowell/db.js#getting-a-single-object-by-key

below is the code which gives error -

server.boxro.query('page1').only(page).then(function(results){
                    console.log(results);
                    makeAppend(jQuery(results));
                });
aaronpowell commented 6 years ago

I'd say that I have an error in the docs, can you try:

server.boxro.query('page1').only(page)
    .execute()
    .then(function(results){
                    console.log(results);
                    makeAppend(jQuery(results));
                });
rebootcode commented 6 years ago

great! That is working now.

Thanks so much.