mongo-php-driver | The Official MongoDB PHP driver | Database library
kandi X-RAY | mongo-php-driver Summary
kandi X-RAY | mongo-php-driver Summary
This extension is developed atop the libmongoc and libbson libraries. It provides a minimal API for core driver functionality: commands, queries, writes, connection management, and BSON serialization. Userland PHP libraries that depend on this extension may provide higher level APIs, such as query builders, individual command helper methods, and GridFS. Application developers should consider using this extension in conjunction with the MongoDB PHP library, which implements the same higher level APIs found in MongoDB drivers for other languages.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of mongo-php-driver
mongo-php-driver Key Features
mongo-php-driver Examples and Code Snippets
Community Discussions
Trending Discussions on mongo-php-driver
QUESTION
I am trying to do an aggregation using this array:
...ANSWER
Answered 2018-Nov-02 at 08:20The problem was on my side. Even though the code was correct, there were a series of invisible UTF8 chars in the array keys or values that the driver was taking into account. Opening that file with VIM allowed me to see those characters and removing them worked. https://jira.mongodb.org/browse/PHPLIB-396
QUESTION
Our application is running on a (very) old MongoDB 2.4 cluster - for now, it's not possible to upgrade it to newer versions.
We were working on upgrading our application from PHP 5.6 to PHP7, everything was going fine until the version 1.4.0 of the mongodb driver deprecated MongoDB 2.4 support.
Since we need to support 2.4
, I tried to rollback the driver version to 1.3.0
and 1.3.2
and both of them are throwing this error:
Call to undefined method MongoDB\Driver\Server::executeReadCommand()
This executeReadCommand()
seems to be something from 1.4.0
, but how can that be if I'm using the version 1.3.0
? Am I missing something?
PHP Configuration:
...ANSWER
Answered 2018-Feb-15 at 13:08Well, of course, there's something missing!
Right after posting this I noticed that I completely forgot to declare the version of mongodb/mongodb
inside composer.json
, so composer was downloading always the latest version of the library, which is 1.3.0
.
mongodb/mongodb
also deprecated support to 2.4
in their 1.3.0 release.
I was able to fix the issue by locking the version of mongodb\mongodb
to 1.2.0
in composer.json
:
"mongodb/mongodb": "1.2.0"
Hope this helps someone that might be facing the same issue.
Cheers
QUESTION
After many comes and goes I managed to install the MongoDB Driver for PHP 5.6 and made it work on OSX El Capitan. (The way it worked was using Homebrew)
To start working on a project I created the folder for the project and using Composer installed the required packages I needed. Between theese packages I required mongodb/mongodb which is the recomended mongo php library to use by the php Manual on line and in the driver github page.
The problem I found is that Eclipse is resolving the classes in the \MongoDB\ namespace but not in the \MongoDB\BSON\ namespace. If I check what Composer installed in the vendor folder I am able to see that the \MongoDB\BSON\ classes in fact are missing. On the other hand if I run the program in the PHP included webserver, it executes as expected.
So my question is how can do or what am I missing for Eclipse to find the missing classes. Are they defined somewhere else?
If this is not possible because they are compiled into a binary library and I have no way to resolve them, Is there any way to have Eclipse not showing these particular classes as mistakes?
Example of class that runs ok in the webserver, but is highlighted as an error in Eclipse:
...ANSWER
Answered 2017-Sep-04 at 18:30Reading this post and not finding anything newer on the subject I arrived to the conclusion that developers of the driver don't provide the php sources and leave it to the IDE developers to provide STUBs for the different fuctions of the driver in a way the IDE can recognize the functions and provide syntax checking and documentations popups.
Following this question, I finally ended up finding a JetBrains GitHub where there are many different stubs for PHPStrom, this one among them.
So I copied the file and added it to my project as part of the sources. And that solved my problem.
QUESTION
I'm trying to set up a PHP 7.1.6.1 installation with the Mongo driver for PHP. (v1.2.9) However the Mongo
class isn't loaded although phpinfo()
tells me that the mongo extension is loaded.
Here's what I've done:
...ANSWER
Answered 2017-Jun-19 at 12:24https://github.com/mongodb/mongo-php-driver says:
Please note that the new HHVM and PHP drivers implement a different API from the legacy driver at http://pecl.php.net/package/mongo; therefore existing libraries that use the legacy driver (e.g. Doctrine MongoDB's ODM) will not work with the new drivers.
The list of classes is at http://docs.php.net/manual/en/set.mongodb.php - "Mongo" and "MongoClient" are not among them.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install mongo-php-driver
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page