Bookshelf: Is using collection.models safe?

Created on 27 Jun 2016  路  2Comments  路  Source: bookshelf/bookshelf

Hi guys,

I'm using collection.models to iterate on the models after fetchAll().
Since it's not in the documentation, could there be a problem or is it safe to use ?

Thanks !

question

Most helpful comment

Hi @Titozzz

I would suggest you to use the standard way that Bookshelf provides. All collections are populated with a list of lodash methods. The full list of lodash methods are also documented.

So you could easily do:

collection.map(function(model) {
  // perform mapping operation
})

All 2 comments

Hi @Titozzz

I would suggest you to use the standard way that Bookshelf provides. All collections are populated with a list of lodash methods. The full list of lodash methods are also documented.

So you could easily do:

collection.map(function(model) {
  // perform mapping operation
})

Thank you very much,
Will update my code then :smile:
@vellotis

Was this page helpful?
0 / 5 - 0 ratings

Related issues

XavierGeerinck picture XavierGeerinck  路  3Comments

josdotso picture josdotso  路  3Comments

jhnferraris picture jhnferraris  路  4Comments

jesobreira picture jesobreira  路  3Comments

MarkHerhold picture MarkHerhold  路  3Comments