Questions tagged [php-mongodb]

MongoDB driver: PHP Extension for Mongo DB

Unlike the mongo extension, this extension supports both PHP and HHVM and 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. This separation of concerns allows the driver to focus on essential features for which an extension implementation is paramount for performance.

168 questions
3
votes
0 answers

Failed to read x bytes from socket within x milliseconds

Can anyone explain what this means and what I can do about it? Failed to read 4 bytes from socket within 300000 milliseconds It happenes again and again during bulk writes to MongoDB with the new PHP driver for MongoDB. The full error message…
Michael Käfer
  • 1,597
  • 2
  • 19
  • 37
3
votes
2 answers

Set filter with regex in query with PHP's MongoDB\Driver\Query class

Using MongoDB with PHP's MongoDB driver I am not able to filter search results with regular expressions. In the manual there are no examples given how to use the "filter" option: MongoDB\Driver\Query. $manager = new…
Michael Käfer
  • 1,597
  • 2
  • 19
  • 37
3
votes
1 answer

Mongodb php7, Update document by id?

I moved from mongo to mongodb extension when I upgraded to PHP7. The only thing I cannot figure out is to update a doc by id. Mongo used to have the MongoId Class to parse the id from string but I can't find any equivalent for Mongodb. This is…
Eric
  • 9,870
  • 14
  • 66
  • 102
2
votes
3 answers

How to get conditional fields in Mongodb

Hello good developers, I am new to MongoDB and trying to fetch conditional data for my requirements. I have the following collection: [ { "id":10001, "name":"Test 1", "status":"live", "traffics":[ { …
Pankaj Jha
  • 886
  • 15
  • 37
2
votes
1 answer

why 'appName' is missing in mongodb currentOp for some command?

I applied appName for some of my projects but in currentOp it is missing for some queries. Mostly it is missing for count query. { "desc" : "conn1786739", "threadId" : "140671499200256", "connectionId" : 1786739, …
Rahul
  • 249
  • 2
  • 12
2
votes
1 answer

$lookup with php mongodb

I have a Student Table in mongo db like { "_id": ObjectId("5baa85f61d7859401000002a"), "Name": "Bella Dave", "RollNo": 12, "Class": "Ist", "TransportDetails": [ { "RouteId":…
2
votes
2 answers

How to find on the basis of case-insensitive value in MongoDB PHP?

How to find on the basis of case-insensitive value in MongoDB PHP? I am using below lines of code $query = ['VehicleNumber' => $arg]; $cursor = $this->collection->find($query); I want to find the data on the basis of VehicleNumber but it should be…
Nida Amin
  • 735
  • 1
  • 8
  • 28
2
votes
1 answer

update multiple elements in an array in mongod php

I have a document like { "_id": ObjectId("5b570181d2ccda05180055ed"), "VehicleNumber": "7656hhh", "DriverDetails": [ { "DriverEntryId": "5016cfe5-e5ca-f9e1-35c6-1ab1d09230fb", "DriverId": ObjectId("5b488d70d2ccda01840078e6"), …
Nida Amin
  • 735
  • 1
  • 8
  • 28
2
votes
1 answer

php mongoDB aggregate() returning MongoDB\Driver\Cursor Object instead of result

i am working on the migration to the new php driver from mongodb, at this moment i have no idea what exactly the problem is, the query works fine with the old driver, actually i am getting no query or php error. The print_r returns the serult of…
Aswin TK
  • 118
  • 12
2
votes
1 answer

How to do conditional update in mongo db?

I am trying to update document's sub document like below lines of code $bulkbatch = new MongoDB\Driver\BulkWrite(['ordered' => true]); $subDocumentStatus = array( "Status" => array( "CurrentStatus" => $this->EmployeeStatus, …
Nida Amin
  • 735
  • 1
  • 8
  • 28
2
votes
1 answer

PHP72 MongoDB driver with Homebrew on OSX

I have a question that might point to a misunderstanding I have with Homebrew in relation to MongoDB: I am running XAMPP (version) with PHP 7.2.1 (which I want to use) on Mac OSX 10.12.6 (Sierra). I installed MongoDB and created configuration and…
RalfB
  • 563
  • 1
  • 7
  • 22
2
votes
1 answer

Adding mongodb extension to PHP-7.1.9 XAMPP Ubuntu

I have installed lampp(XAMPP) server on my ubuntu pc and now I want to add mongodb extension to it's PHP. So I tried sudo /opt/lampp/bin/pecl install mongodb and it successfully installed it. But after that, when I try to start lampp server It just…
Vajira Prabuddhaka
  • 852
  • 4
  • 13
  • 34
2
votes
1 answer

Query only "sec" field from MongoDate using PHP

I have a string converted to MongoDate using $dateAdded = new MongoDate(strtotime("$time")); echo "date ".$dateAdded; So my $dateAdded now looks like 0.00000000 1482505458. (Here 1482505458 is the number of seconds and 0.00000000 is in…
Anubhav
  • 147
  • 1
  • 13
2
votes
1 answer

Fatal error: Call to a member function find() on a non-object?

I have tried Mongo geospatial Query in PHP.. I have faced Following Error i have wrote 2 PHP script.. in my GeoPHP create Object From Class and Call the Member Method And my another PHP script class.master.php wrote a class and Member…
Balakumar B
  • 770
  • 5
  • 17
  • 41
2
votes
1 answer

To make things right, you must install php_mongo module

I am not able to install the php mongo driver in a VPS. I've followed this and this documentantion I checked this stack here but i can't figure out what I am doing wrong. The VPS runs on PLESK 12 and CentOS 7. lets say that I have the domain…
Carlos Vicient
  • 113
  • 2
  • 7
1
2
3
11 12