.random()
Returns one or more random entries from the collection.
random(amount)
Parameter
Default
Description
// Note: Users is a collection.
Users.get(); // [{ name: 'John' }, { name: 'Michael' }, { name: 'Peter' }]
Users.random(); // { name: 'Michael' }
Users.random(2); // [{ name: 'John' }, { name: 'Peter' }]
Last updated
Was this helpful?