So, I am new to symfony and need to create an api in it for a project at college. Normally I would go through some tutorials, but I do not have the time to properly learn symfony and we were only taught the basics. I have a collection of users containing name, email, password and I want to return all
Tag: mongodb
MongoDB & PHP | How to add into object that is inside an array?
I am new to MongoDB and PHP and I am trying to make an API. The current problem I have is that I am not able to add an array into an object that is inside an array (of objects). I have tried a lot, but all failed. This is the document I have so far: I would like to
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
Insert multiple documents in mongodb collection with a single insert statement using php
In PHP I have some data to insert. The sample data is shown below I would like to insert each element of the array as single document. For example :- should be inserted as a separate document . This should be achieved using a single insert statement . Also the version of mongodb being used is 2.4 so I cannot
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
MongoDB Aggregation “group” with “max” field within a sub-array
Using Compass initially, I then need to convert it into the PHP library. So far, I have a 1st stage that filters the documents on 2 fields using $match: comp.id (sub-document / array) playerId Code is: $match (from drop-down) This returns 2 documents. The document has a sub-array holes, for the holes played in a round of golf. This sub-array
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
MongoDB nested lookup with 3 levels and append new value to the result docs
I need to retrieve the entire single object hierarchy from the database as a JSON. Actually the proposal about any other solution to achive this result would be highly appriciated. I decided to use MongoDB with its $lookup support. So I have four collections: Users Posts Comments Replies I basically need to retrieve all posts with all corresponding comments and