Comments (13)
Can you paste your example code?
It looks like you might be doing $collection->insertOne($document, $options);
where $options["writeConcern"]
is not an instance of MongoDB\Driver\WriteConcern
from mongo-php-driver.
oh, sorry.
/** @var MongoDB\Collection $collection */
$collection->insertOne([
'foo' => 'bar',
]);
from mongo-php-driver.
I've created MongoDB\Collection with $writeConcern = null.
Below I see $this->writeConcern = $writeConcern ?: $this->manager->getWriteConcern();
var_dump($this->manager->getWriteConcern())
in vendor/mongodb/mongodb/src/Collection.php:69 shows
array(4) { ["wmajority"]=> bool(false) ["wtimeout"]=> int(0) ["fsync"]=> NULL ["journal"]=> NULL }
from mongo-php-driver.
My mongodb.so was built from PHP7 branch of this repo, because I'm using php7
from mongo-php-driver.
The var_dump
will call the debug handler on the object, which is why you see it as array.
If you do
$wc = $this->manager->getWriteConcern();
var_dump(get_class($wc), $wc);
it should print out MongoDB\Driver\WriteConcern
from mongo-php-driver.
I got 'Warning: get_class() expects parameter 1 to be object, array given'
from mongo-php-driver.
heh. uhm.. OK.... thats weird!
from mongo-php-driver.
Can you try this for me:
$ php -r '$manager = new MongoDB\Driver\Manager("mongodb://localhost:27017"); $wc = $manager->getWriteConcern(); var_dump($wc);'
I get the following:
object(MongoDB\Driver\WriteConcern)#2 (4) {
["w"]=>
NULL
["wmajority"]=>
bool(false)
["wtimeout"]=>
int(0)
["journal"]=>
NULL
}
from mongo-php-driver.
php -v && php -r '$manager = new MongoDB\Driver\Manager("mongodb://localhost:27017"); $wc = $manager->getWriteConcern(); var_dump($wc);'
PHP 7.0.0 (cli) (built: Dec 5 2015 00:06:25) ( NTS )
Copyright (c) 1997-2015 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
with Xdebug v2.4.0RC2, Copyright (c) 2002-2015, by Derick Rethans
array(4) {
["wmajority"]=>
bool(false)
["wtimeout"]=>
int(0)
["fsync"]=>
NULL
["journal"]=>
NULL
}
from mongo-php-driver.
Ahhh. Found it.
You are using the PHP7 branch. It is no longer the most-up-2-date. @jmikola has a PR that is the latest version -- not entirely sure why its not merged into the branch or the branch deleted..
Using his PR it works for me (tm).
See: #136
from mongo-php-driver.
I've said it earlier: #153 (comment) :-)
Ok, thx, I'll be watch for progress.
from mongo-php-driver.
Yeah, sorry. I mistakenly read it as if you were using @jmikola PHP7 branch, as thats what I was using hehe. Sorry :)
from mongo-php-driver.
#175 (PHP 7 support) has been merged to master, so I think this can be closed. We should have a release with those changes out in a day or two. Feel free to re-open if that's not the case.
from mongo-php-driver.
Related Issues (20)
- apache stop when I added extension=mongodb.so to php.ini HOT 3
- `selectServer` takes too long on official php base image (connections opened sequentially) HOT 13
- libbson Bug Report : variable ret value type error HOT 8
- No suitable servers found (`serverSelectionTryOnce` set) when rs.initiate with localhost HOT 5
- Extract mongodb-1.6.2.tgz error HOT 5
- Sporadic "Authentication failed" errors HOT 8
- MongoDB PHP Driver 1.15+ increases PHP memory consumption HOT 7
- Error while compiling on macOS HOT 7
- Major slowdown since version 1.17.0 HOT 8
- PHP Warning: PHP Startup: Unable to load dynamic library 'mongodb.so' HOT 2
- MongoDB reporting "AuthenticationAbandoned: Overridden by new authentication session" for a PHP client HOT 14
- Windows build after 1.13.0 HOT 4
- linux general protection fault , sorry for my poor english HOT 1
- PHP refusing to load MongoDB PHP driver on Windows (on one machine but not another) HOT 1
- Can't download desired extension HOT 2
- Unable to install pecl mongodb-1.15.1 in php 8.2 HOT 1
- Bug & Question: How to compile mongodb statically into PHP? HOT 9
- PHPStorm Stub for Manager class has outdated signature HOT 1
- Cannot install with laravel 11 HOT 1
- Cannot run ./configure cmd - error: cannot find input file: 'config.h.in'
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-driver.