Skip to content
Advertisement

Tag: mongodb

How to get mongodb collection iterator?

I’m connecting to mongo db like this: Getting collection like this: And getting collection iterator like this: However last call shoots error: [error] Could not retrieve source count from demo_article: Authentication failed. What I’m doing wrong here? UPDATE: Here: iterator is Traversable. But then, this code is called from SourcePluginBase: and it’s not Traversable?! How can it loos that traversable

MongoDB PHP Error: Warning: Undefined property: MongoDBDriverManager

I’m trying to use MongoDB on my local machine using the advice in this stack overflow. I’m using XAMPP on Windows 10, php version 8.01, and MongoDB extension 1.9.0. It’s a very basic script that connects to MongoDB and tries to use one of the databases. But I am still getting this warning: This is my code: How can I

How to get object id from array using php mongod

I have a array $document after query findOne() I want get 60d2f531a5476f4eb220402b by use $document[‘_id’]->__toString(); but it never work Answer The stdClass object does not have any methods by default, so you address the $id field like this

PHP updating multiple elements of sub-array of MongoDB document

I have the following document structure. I am trying to update specific values inside the holes sub-array: Each holes Array element is an Object representing the score on a golf hole, with various properties (fields). I am trying to provide the ability to update the holeGross field ONLY for each score. On my PHP website, this is using a POST

Insert a Json object in MongoDB from Laravel 7

I need upload a image to Google storage and insert the below JSON object with the gcs image path in MongoDB. The image is successfully getting uploaded in GCS, but I am not able to get the image url of the image and also not able to update the path in mongoDB. JSON object format Can anyone help me to

Advertisement