Skip to content

Tag: mongodb

Is such a result possible with a query from an SQL database?

I want to fire a query to get such a result: Tables Schema I guess it’s not possible like that? I don’t have any experience with text-based databases, but I can well imagine that this can be achieved with a MongoDB. Because ultimately I want to have a js object at the end of the day. Answer Here&#…

Perform Calculation in MongoDb Query

Supposed I have the collections that contain Event type Product View water_heater View water_heater Purchase water_heater View television View television View television Purchase television There are two types of fields in the first column, (views and purchase) The second column contains different kinds of pr…

Mongodb for projects with many to many relationships

I’m at the beginning of starting a project for learning backend development with a bit of frontend development. For that, I wanted to create a project around cooking recipes. The plan was to create an admin REST API that would be later used by a custom CMS to create, edit, delete,… recipes and a p…

Mongo Group By query

I have data stored in a Mongo collection that is structured like this: I wish to construct a query that would let me sum up each count in each entry and group by requestingSupplier. For example, I would like to answer the question, for the month of January ’22, what was the sum of each entity and get a …

How do I convert this to mongodb aggregate query?

SELECT prop_type , count(prop_type) As no_of_properties from prop_type JOIN prop_for_rent USING (prop_type) GROUP BY prop_type; prop_type and prop_for_rent are both tables. Then “prop_type” used for the JOIN and GROUP BY is an attribute name in both. The expected result is for the query to count t…