question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Need to be able to treat collection as array

See original GitHub issue

Collection exposes one array method length, but a common pattern is to clone the array of data by calling toArray() on the collection of models. This is not currently possible since the models array is nested inside of Collection.

Can/will you expose other array methods so a collection can be treated as an array?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
patrickberkeleycommented, Jul 31, 2019

✅ understood and fixed. Thank you.

0reactions
samselikoffcommented, Jan 18, 2021

If you want to get everything in the database try ‘server.db.dump’. This will give you the data in Mirage’s raw db format (camelCase, foreign keys and such). If you want to go through your serializer layer try ‘server.serialize(modelOrCollection).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Collection Methods
This procedure has three forms. DELETE removes all elements from a collection. DELETE(n) removes the n th element from an associative array or...
Read more >
Convert an Array into Collection in Java - GeeksforGeeks
This method is used in converting the given array to the List object. To use this method, we have to import the package...
Read more >
Convert Array To Collection in Laravel - Stack Overflow
Short answer extended: There are different collections. 1. collect(array $array) or 2. new \Illuminate\Database\Eloquent\Collection(array $array) ...
Read more >
PL SQL Collections: Nested Table, Associative Array And Varray
Learn the basics of PL SQL Collections, Collection Methods, Varray, Nested table, and Associative Array with the help of code examples.
Read more >
Array.from() - JavaScript - MDN Web Docs
Array.from() has an optional parameter mapFn , which allows you to execute a function on each element of the array being created, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found