Questions tagged [aggregation]

The concept of aggregation refers to the relationship between two classes, often characterized as a "has-a" and "whole/part" connection.

Searching for documents in MongoDB that meet specific criteria has become possible through the use

Criteria: COUNT the total number of documents in the collection WHERE objects.objectType is 'group' AND (objects.objectType is NOT 'person' AND relation is 'Exposed_to') Expectation: should return the count of all documents WHERE objects.objectType is 'gr ...

Contrasting pandas aggregators: Exploring the disparity between .first() and .last()

I'm interested in understanding the specific functionality of last() and first() when applied to resampling. My interpretation is that when numerical arguments are passed into these functions, like 3 for example, they return the first 3 months or years. I ...

Currently experiencing difficulties with aggregation lookup. Seeking the output of the lookup to match the specified structure

Database Schema categories: [{ category: { type: Schema.Types.ObjectId, ref: 'Category' }, subCategory: [{ type: Schema.Types.ObjectId, ref: 'Category' }] }] Data Retrieval Query { $lookup: { ...

What is the best way to retrieve data from an entity with Prisma where the number of its children exceeds a certain threshold?

I am working on a project where I have an entity called Author that can have multiple Books associated with it. My goal is to retrieve all Authors who have more than 5 books in my database. The application is built using Prisma in conjunction with Next.js ...

Group records in MongoDB by either (id1, id2) or (id2, id1)

Creating a messaging system with MongoDB, I have designed the message schema as follows: Message Schema: { senderId: ObjectId, receiverId: ObjectId createdAt: Date } My goal is to showcase all message exchanges between a user and other users ...