1

good afternoon,

I'm not able to do the "select" in php for MongoDB.

I need 20 random results. I'm trying to use the rand () function, but I can not make it work.

I'm trying this:

 return $db->anuncios->find()->rand()->limit(20);

But is not working.

samuel_R
  • 501
  • 1
  • 5
  • 18
  • This has been disussed about 10 times if you search google: http://stackoverflow.com/questions/2824157/random-record-from-mongodb as a brief example. One thing, I would recommend not using `skip` if you can. – Sammaye May 01 '13 at 12:54

0 Answers0