lundi 6 avril 2015

How to get JSON collections using Bookshelf

I am using Bookshelf, and I want to do something like this:



function myfunc() {
this.vals = Accounts.forge().fetch();
}


I can get the collection object, but I can't call .toJSON on it to store in this.vals. What am I missing? I can access the collection in a .then() promise:



.then(function(collection) {
console.log(collection.toJSON());
})


How can I store this JSON in this.vals?


Aucun commentaire:

Enregistrer un commentaire