-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$collection->find(); bson error, new Query() fails #52
Comments
What do you mean "silently fails"? |
Code example: <?php
ini_set("display_errors",1);
require_once 'vendor/autoload.php'; // include Composer goodies
$manager = new MongoDB\Driver\Manager("mongodb://localhost:27017");
$collection = new MongoDB\Collection($manager, "my_db.my_table");
//$result = $collection->insertOne( [ 'name' => 'Hinterland', 'brewery' => 'BrewDog' ] );
$cursor = $collection->find([ 'name' => 'Hinterland']);
echo "Searching for citizen => Iceland, verify Hayley is now Icelandic\n";
foreach($cursor as $document) {
var_dump($document);
}
?> /var/tmp/mongodb/src/libbson/src/bson/bson.c:1825 bson_init_static(): precondition failed: data |
Can you run the example in
This would print out a lot of debug information. |
[2015-11-26T06:59:57+00:00] PHONGO: DEBUG > Connection string: 'mongodb://localhost:27017' |
As I see $options is invalid, $query = new Query($filter, $options), Output from $options:
|
I'm having the exact same problem with 0.2.0 of the library.
mongodb mongodb support => enabled Directive => Local Value => Master Value I tried commenting out all of the variables returned by getFindOptions() method one by one, and re-running my Find(), but it still failed. As the OP said, if you modify _buildQuery to remove passing in the $options array, things succeed. If I upgraded to v1.0.0-beta1, the problem went away. Using > db.version() 3.0.7 |
Sorry for the lack of updates here. I'm pretty sure this is fixed in the latest pecl/mongodb release, 1.1.0. Could you confirm? 1.1.1 is also being released any moment now with PHP7 support, if you'd like to wait and try that out -- it has rewritten lot of this code path to simplify certain things. |
Closing this out due to inactivity. Please follow-up if the issue still persists in the more recent releases of the library and driver (1.1.1 is the latest and includes PHP 7 support, and we should have a 1.1.2 release out soon). |
Collection.php
Line: 1139: $query = new Query($filter, $options); silently fails.
For now just to get working: i replaced this line with: $query = new Query($filter);
I'll try to find a write way to fix this and will update the information.
The text was updated successfully, but these errors were encountered: