Skip to main content

All Questions

Tagged with
0 votes
0 answers
38 views

find and save percentage of two columns in mongodb

I have $a and $b colons in mongodb. I want to do the following in $c column with PHP. $number = $a/$b * (100-100); That is, I want to find the percentage change and save it in column $c. can you help ...
Yusuf Damista's user avatar
0 votes
0 answers
82 views

Mongos connection not cleared

We have MongoDB shard server setup with Router + Config + 2 Shard servers [MongoDB version 4.4] and accessing the mongos connections via 4 servers with PHP7. Recently add 1 extra server(4+1=5) with ...
tkraja mdu's user avatar
0 votes
0 answers
29 views

Issue with MongoDb $facet Aggregation Query - Getting Data in Separate Limits Based on Domain IDs

I have encountered an issue with an aggregation query in my PHP application. The purpose of this query is to retrieve data from a MongoDB collection while applying different limits based on domain IDs....
Nitish Roy's user avatar
0 votes
1 answer
60 views

How to write gte filter for Learning Locker Aggregation API (Arguments must be aggregate pipeline operators)

I'm writing a request for LRS service. I need to get from there statements that were created in the range of some date. The filters gte and lte are suitable for this. But the documentation (and this) ...
MasterEnotus's user avatar
0 votes
1 answer
107 views

MongoDB updateOne creates duplicate field instead of updating existing field

I'm using the updateOne method in MongoDB to update a field in a document. However, instead of updating the existing field, it creates a duplicate field with the new value. Here's the code I'm using: $...
Spike Spiegel's user avatar
0 votes
1 answer
311 views

MongoDB with PHP - Fatal error: Uncaught Error: Call to undefined method MongoDB\Driver\Cursor::limit()

Am trying to fetch data from MongoDB using PHP. I have implemented the following code: $all_items = $collection ->find( $where_search, array('_id', 'name', 'email', 'bod', 'mobile') ) ...
Sam.'s user avatar
  • 59
0 votes
1 answer
56 views

How can I retrieve a distinct count of rows from a specific column Mongo DB collection via a Laravel REST Api controller?

I have a React-based web application that's being supported on the back-end by a REST API written in Laravel. I need to display the count of from a specific column in a collection in the database, ...
connoisseur's user avatar
0 votes
1 answer
80 views

Accessing object value from nested objects in mongodb with php

trying to get the value of candidate_id and count how many votes has been voted for a candidate how do I access the candidate_id in php and count it MongoDB Structure { "_id": { "$oid&...
The-_-King_ 464's user avatar
0 votes
1 answer
53 views

How to group by two conditions in PHP

How to make a query like this with MongoDB and PHP: (ex. in SQL) SELECT SUM(visits),* FROM db_name WHERE name = 'john' GROUP BY date I wanna show all dates with sum of visits all persons with name is ...
Łukasz Trześniewski's user avatar
0 votes
1 answer
37 views

GROUP BY AND SUM queries

I can't find working solution for this. I wanna for example make the query like (in SQL): "SELECT SUM(visits),* FROM db_name WHERE name = 'John' GROUP BY date When I use code like: $data=$...
Łukasz Trześniewski's user avatar
0 votes
1 answer
14 views

Who to update documents in collection found using $lookup $match

A simple version to explain my issue. I have two collections. I need to update the 'person' collection (club field) based on a $lookup/$match query against the 'colour' collection. db.person....
Daniel Alvers's user avatar
0 votes
1 answer
311 views

How to do a wildcard search with mongoDB and PHP

I'm new to mongo DB and I want to learn how to do a wild car search on a collection. I have a data base like so: term,value greenwoods,1 blackberry,2 greenday,3 a Green apple,4 blacksmith,5 and my ...
Druz's user avatar
  • 75
0 votes
1 answer
47 views

Getting empty object while fetching data between two Dates in mongoDB

I am trying to fetch MongoDB data using CURL with PHP. My code is like below. curl_setopt_array($curl, array( CURLOPT_URL => $this->apiPath . $action, ...
abu abu's user avatar
  • 6,912
1 vote
0 answers
22 views

update whole MongoDb Document in PHP

I wants to update whole MongoDb Document in PHP like: UserCollection.findOneAndUpdate({ _id: user._id }, user, { returnNewDocument: true }) "user": { _id: "62612f9da4eb57878f89291b"...
skodret solutions's user avatar
0 votes
1 answer
311 views

Unable to search data in a mongodb database using laravel

I am trying to write a query to search the mongodb database for a specific query and return the associated information here is what I have done so far: In Post: <?php namespace App\Models; use ...
Anshul Raj's user avatar

15 30 50 per page
1
2 3 4 5
21