How to execute mongodb query in php
I'm in a situation where I need to be able to run a direct mongodb query from inside of PHP, and am having troubles with the execute() function. The following code will correctly execute and return a result from the database:
However, if I replace count() with find() I get the following result:
Why does one of these queries work, and the other fail? And how can I overcome this issue? I've thought about writing something that will convert a MongoDB query into the necessary array format for the PHP Mongo library to work with, but that would be a lot of work that I don't want to go through. This is the same problem that was brought up here: How to access MongoDB profile in PHP? - but no answers were given at that time. This question: PHP MongoDB execute() locking collection utilizes the execute() method with find() and they say it works for them, but I'm not sure how. Update:So I'd updated mongo in pecl, but that didn't solve anything. However, I also did a YUM update, and that provided a separate package update for php-pecl-mongo-1.2.12-1.el6.x86_64 that brought me to 1.3.4-1. Now,
As you can see, there's not actually anything from the database there: how do I get to my actual rows?
|