Pedro Quinteros
Pedro Quinteros

Reputation: 21

Search random in Mongodb and Meteor.js

How can I do a random search in Mongodb and Meteor.js, so that the results do not always go in the same order?

Upvotes: 1

Views: 63

Answers (1)

Joost Döbken
Joost Döbken

Reputation: 4017

You can use lodash shuffle like:

_.shuffle(CollectionName.find().fetch())

Upvotes: 1

Related Questions