Reputation: 305
I'm currently doing this:
$t_category = 781;
$res = $collection->findOne(array("_id" => intval($t_category)));
this way i am getting only one category (it was just to try). How can I get all categories (documents->_ids) in php->mongo? A way I could iterate over all the documents in the collection. I have tried the find with no arguments. No luck. Any idea?
Upvotes: 0
Views: 687
Reputation: 13348
Calling find
with no arguments will return all items in the collection.
$results = $collection->find();
Upvotes: 1