Comments (8)
What do you mean "silently fails"?
Does PHP just stop execution and nothing happen? That'd indicate it segfaults..
from mongo-php-library.
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
Aborted
from mongo-php-library.
Can you run the example in debug mode
?
For example, say the PHP code above is in the filename example.php
you'd run:
php -dmongodb.debug=stderr example.php
This would print out a lot of debug information.
If you could save it all to a file and upload/paste it here, it would help a lot, thanks!
from mongo-php-library.
[2015-11-26T06:59:57+00:00] PHONGO: DEBUG > Connection string: 'mongodb://localhost:27017'
[2015-11-26T06:59:57+00:00] PHONGO: TRACE > ENTRY: php_phongo_make_mongo_client():1729
[2015-11-26T06:59:57+00:00] PHONGO: DEBUG > Creating Manager, phongo-1.0.0[stable] - mongoc-1.2.0(bundled), libbson-1.2.0(bundled), php-5.6.14
[2015-11-26T06:59:57+00:00] mongoc: TRACE > ENTRY: mongoc_topology_description_init():51
[2015-11-26T06:59:57+00:00] mongoc: TRACE > EXIT: mongoc_topology_description_init():67
[2015-11-26T06:59:57+00:00] mongoc: TRACE > ENTRY: mongoc_server_description_init():88
[2015-11-26T06:59:57+00:00] mongoc: TRACE > EXIT: mongoc_server_description_init():122
[2015-11-26T06:59:57+00:00] cluster: TRACE > ENTRY: mongoc_cluster_init():1523
[2015-11-26T06:59:57+00:00] cluster: TRACE > EXIT: mongoc_cluster_init():1546
[2015-11-26T06:59:57+00:00] client: DEBUG > Using custom stream initiator.
[2015-11-26T06:59:57+00:00] PHONGO: TRACE > EXIT: php_phongo_make_mongo_client():1797
/var/tmp/mongodb/src/libbson/src/bson/bson.c:1825 bson_init_static(): precondition failed: data
Aborted
from mongo-php-library.
As I see $options is invalid, $query = new Query($filter, $options),
because when I do $query = new Query($filter) it works.
Output from $options:
Array
(
[allowPartialResults] =>
[batchSize] => 101
[comment] =>
[cursorType] => 0
[limit] => 0
[maxTimeMS] => 0
[modifiers] => Array
(
)
[noCursorTimeout] =>
[oplogReplay] =>
[projection] => Array
(
)
[skip] => 0
[sort] => Array
(
)
[cursorFlags] => 0
)
from mongo-php-library.
I'm having the exact same problem with 0.2.0 of the library.
"mongodb/mongodb": "^0.2.0"
mongodb
mongodb support => enabled
mongodb version => 1.0.1
mongodb stability => stable
libmongoc version => 1.2.0
libbson version => 1.2.0
Directive => Local Value => Master Value
mongodb.debug => no value => no 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
from mongo-php-library.
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.
from mongo-php-library.
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).
from mongo-php-library.
Related Issues (20)
- PHP+MongoDB: "Return value must be of type MongoDB\Driver\Server, null returned" HOT 3
- Can we drop `jean85/pretty-package-versions:1.2`? HOT 4
- Decision about `mongo-orchestration` folder and `Makefile` HOT 3
- [Documentation] Syntax highlighting in the method reference is not ideal HOT 1
- A never-ending query after upgrade to MongoDB 6.0.3 HOT 6
- Memory leak on updateOne in the loop HOT 1
- Deprecated: Return type of MongoDB\Model\BSONDocument::bsonSerialize() HOT 2
- The StreamWrapper class is currently unusable without the bucket HOT 4
- Performance issue with PHP 8.2 HOT 2
- Extract mongodb-1.6.2.tgz error HOT 1
- MacOs M1 Cannot connect to Atlas After upgrade driver HOT 7
- This is a test
- $unset not properly work on multiple field? HOT 1
- Docs: missing `]` character in database->aggregate documentation HOT 1
- Question about fieldPaths (feature request?) HOT 1
- Non blocking io HOT 1
- $where is not allowed in this context HOT 2
- TLS connection with mongo cluster failed (while single host works) HOT 2
- getting result from mongodb with toArray() HOT 3
- Getting the error in driver version 1.14 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongo-php-library.