Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我目前正在这样做:
$t_category = 781; $res = $collection->findOne(array("_id" => intval($t_category)));
这样我只得到一个类别(只是尝试)。如何在 php->mongo 中获取所有类别(文档->_ids)?一种我可以遍历集合中所有文档的方法。我已经尝试了没有参数的查找。没运气。任何想法?
不带参数调用find将返回集合中的所有项目。
find
$results = $collection->find();