Questions tagged [aggregation]

Aggregation is a relationship between two classes that is best described as a "has-a" and "whole/part" relationship.

Filter by
Sorted by
Tagged with
0 votes
0 answers
14 views

MongoDB sliding window aggregations

Imagine i have set a 5 minute time window.I want to have 5 sec sliding windows within the 5 minute window i have already set and move every second in order to check some data.For example,i have set ...
Elias Theodoridis's user avatar
0 votes
1 answer
22 views

Given a dataframe with duplicated index, how can I merge together rows by reducing with combine_first method?

Consider the following input: import pandas as pd # Create a sample DataFrame with duplicate index values data = {'A': [1, 2, None, 4, 5], 'B': [None, None, 3, None, 4]} df = pd.DataFrame(...
LucaM's user avatar
  • 49
1 vote
2 answers
26 views

Project Array Items as document fields

I need to project phone numbers and emails from array and show them as Document Fields. Something like this: { Name: "Mac", Emails: [ {address: 'mac@mac.com', title: '', isMain: true}, {...
DValdir Martins's user avatar
1 vote
2 answers
75 views

Find the longest prefix for a table of tokenized strings

I have a table (n < 100) with '#'-separated values in Postgres 13+. Sample: id value 1 'ABC#DEF#123#BAIT' 2 'ABC#DEF#156#BAIT' 3 'ABC#DEF#178#BAIT' ... These values can be of any length (e....
Shraneid's user avatar
  • 331
2 votes
1 answer
44 views

mongodb aggregation to flatten recursive child documents

using mongodb and the following document. { "_id": "7741cca6-31d4-4652-aa00-a7d547a16a2e", "kids": [ { "_id": "e6c2f07e-899f-40b5-8ac2-...
dbabob's user avatar
  • 21
0 votes
0 answers
18 views

Cannot aggregate multiple requests from the same microservice using Ocelot

I'm trying to aggregate two requests from the same microservice using Ocelot, but it seems to not be working (when I'm calling the aggregate request route the response is 404). I'm not even sure ...
gabriel neagu's user avatar
0 votes
0 answers
10 views

Use Vega with Elasticsearch nested aggregations

I'm running into a problem accessing key and value of nested aggregations. Here's the ES query: GET discuss-duration/_search { "size": 0, "aggs": { "workflow": { ...
CarolL's user avatar
  • 71
-1 votes
0 answers
9 views

Compare and aggregate indicators at different geographic scale

I encounter a problem in developing an aggregation model of several indicators. Almost all the indicators are at a small geographical scale (admin2 / Provinces), but one is at larger geographical ...
Dorianeve's user avatar
0 votes
0 answers
6 views

How can I display more information than path names when doing aggregation through `group by level`statement in Apache IoTDB?

After doing aggregation through group by levelstatement in Apache IoTDB, seems like the time series cannot be aligned, do the query results can only came back a lot of path name columns? Or how can I ...
Thoreau I's user avatar
1 vote
2 answers
250 views

Given a pandas dataframe with three columns how can I groupby one columns and return the sub-dataframe rows as a dict

Input: pd.DataFrame, e.g. input = pd.DataFrame({ 'A': [ 'asset_one', 'asset_one', 'asset_two', ], 'B': [ 'item_one', 'item_two', ...
LucaM's user avatar
  • 49
0 votes
1 answer
21 views

spring-data-mongodb dependency for @Aggregation annotation for aggregation pipeline

import org.springframework.data.mongodb.repository.Aggregation; Following import is not resolved for <dependency> <groupId>org.springframework.data</groupId> <artifactId>...
Sameer Makwana's user avatar
1 vote
1 answer
29 views

PostgreSQL: Order by one representation, but show another

new to SQL in general, I have this date column, I want to group by day of week and order the result by it, but I want the resulting relation to show the day of week as the name ('Monday', 'Tuesday', '...
Ozz's user avatar
  • 81
0 votes
1 answer
10 views

Tableau Get the Max Date for each employee based on one condition

I'm new to Tableau. I ran into a challenge and cannot find solution online. I have a dataset about employee's task completion KPI. For each employee, he/she gets a list of assignment items. Each ...
vivianna's user avatar
0 votes
1 answer
52 views

How to sum values by symbol in kdb/q, and output to a new table that summarizes the data

I have a table that has incremental data for a symbol, and what I want to do is aggregate the data and create a summary table, where it only shows the symbol, earliest time of data available, and the ...
mmv456's user avatar
  • 13
2 votes
2 answers
35 views

How to project specific fields from subdocument baed on value of field from same document in MongoDB

Given a document with a subdocument from a $lookup aggregation, I want to project a specific field form the subdocument based on the field of the $$ROOT document. Example: { "date": "...
gabikripka's user avatar
0 votes
0 answers
23 views

MongoDb (Mongoose) aggregation issue with $lookup and $project

I am a beginner in MongoDB and am working on my personal project. I am trying to populate employees field for teamSurveyForms, but it is returning Array(0) for teamSurveyForm.employees.Can anyone tell ...
japjot singh's user avatar
2 votes
0 answers
33 views

Aggregation vs Composition in OOP (Java example) [duplicate]

Now I understand the theory of these types of associations: Aggregation implies a relationship where the child can exist independently of the parent. Example: Class (parent) and Student (child). ...
r'ouster's user avatar
0 votes
0 answers
10 views

Hive rolling aggregation with missing data

I've a table where every entry represents 5m of data (say, the number of clicks in last 5m) corresponding to an item id. There won't be any entry provided there's no click to an item in particular 5m ...
masT's user avatar
  • 814
0 votes
0 answers
20 views

Elasticsearch: Get most frequent combinations of nested docs

I have a elasticsearch index with nested documents (colors). I would like to have a query with an aggregation, which shows the most frequent combinations of colors. An example: I have three documents [...
user1383029's user avatar
  • 1,695
0 votes
1 answer
12 views

Explode keywords in a term aggregation (Elasticsearch)

I have a index with songs information. I have a field "Artist Name(s)" where there can be multiple artists separated by a comma. I want to get the count of song by artist with a terms ...
Ant_brun's user avatar
0 votes
1 answer
70 views

What's the best way to deal with circular object-owning references in a one/many-to-many C++ class associations?

Good day. I am facing a programming design task and am struggling with choosing the best approach for implementation due to lack of experience. I'd be glad to hear which practices, paradigms, or ...
Mampac's user avatar
  • 194
0 votes
0 answers
18 views

Data Deduplication and Grouping Aggregation Queries in ES Index

I'm currently facing a challenge regarding the processing of Elasticsearch index data, and I'm looking for assistance and solutions here. I have an ES index that contains two fields: fingerprint and ...
shihongze's user avatar
1 vote
1 answer
37 views

DAX formula to sum individual rows by a given date and show it in a Card

I am trying to sum the inventory units as of a given date (driven by a slicer) and put it in a Card. Measure = CALCULATE ( SUM ( Inv[TY Inv] ), 'DailySales'[Like Date] ) I have this but seems to add ...
Luis Gonzalez's user avatar
2 votes
1 answer
22 views

MongoDB multiple groups in one aggregation

I have the following data [ { _id: ObjectId(), level: 'High', country: 'Palestine' }, { _id: ObjectId(), level: 'Low', country: 'Jordan' ...
Sohayb Saleh's user avatar
1 vote
2 answers
56 views

MongoDB aggregation to group by multiple fields

I have following data in my collection { “name": “test”, "data": { “statusOne”: “enabled”, “statusTwo”: “active” } } { “name": “test”, "data": { “...
user3518008's user avatar
0 votes
0 answers
19 views

In Mongo Compass, how do I fix the group stage of an accumulator object?

I'm using Mongo Compass 1.29 on Windows 10. I'm trying to create an aggregation pipeline to find unique values of a field in my colleciton. The field name is "productId". The first stage ...
Dave's user avatar
  • 16k
0 votes
1 answer
32 views

MongoDB Aggregation: How to push a string onto an array for the entire collection

I have a collection like so... { "_id": { "$oid": "r3d4ct3d" }, "name": "david doan", "dateAdded": "2023-07-21T22:15:13....
Donald Moore's user avatar
0 votes
1 answer
32 views

Lookup return only if find correspondence

I need to check if two collections have correspondent data. I have something like: colA = [ {_id: UUID('8af051fd-feaa-4a81-b34f-327513210eab'), docId: '12345689', name: 'Office 1', country: 'Spain'}, {...
DValdir Martins's user avatar
0 votes
0 answers
48 views

ElasticSearch:sort by sum of top two after group

i want to this result sort by sum of top2 not all,first,group by class,example:A,B,C...,use term;second,sort by socre,get the top2;third,get the sum of top2 not not all;finally,sory by sum of top2 GET ...
xiaomiao gao's user avatar
0 votes
0 answers
16 views

Aggregating Two Django Models with No Direct Relationship - Translating Pandas to Django ORM

I am currently aggregating two QuerySets by merging them based off of a key "pl_id" and grouping by two additional attributes, "zip_code" and "num_itms" with Pandas, but ...
dichter's user avatar
  • 49
1 vote
1 answer
28 views

Conditional Sorting in a mongo aggregation query

I have a collection where some of the documents will have a field called salesInfo this field contains an object with a salesEndDate and a salesPrice. Initially my query sorts the data based on a user ...
CourtneyJ's user avatar
  • 458
0 votes
1 answer
26 views

mongoDB $match aggregation returns empty array when there is no query

i am using $match in aggregation pipeline. When I don't pass the query in $match it prints empty array. But I want all data when there is empty query in $match. same time if query is not match then it ...
kishore kumar's user avatar
0 votes
2 answers
35 views

Selecting suitable database for analytics data

We need to create enterprise product and need to select the storage option for analytics data, initially data will be in tb's(10-40tb) but in coming years could go up to few PB's. Requirements: high ...
Explore Mayank's user avatar
2 votes
1 answer
34 views

Switching long inheritance tree for composition / agreggation

I have a program in Java which uses a lot of inheritance, and it's making it troublesome to modify and test the final derived classes So I'm refactoring, attempting to switch from inheritance to ...
coz's user avatar
  • 33
2 votes
1 answer
38 views

Mongo lookup condition: not exist

We have two collections. One is the books collection with loads of data. Like: { '_id' {"$oid": "64ba6a416504f1f01d773faa"}, 'isbn': 8765434567890, 'booktitle': 'some text'...
Jeex's user avatar
  • 127
0 votes
1 answer
11 views

Query in Mongoose to get all documents with array of objects, based on comparison of 2 fields inside those objects

I have the following array field inside my schema: const receiptSchema = mongoose.Schema( { ... items: [ { product: { type: mongoose.Schema.ObjectId, ...
Hector Toro's user avatar
0 votes
1 answer
88 views

Does Clickhouse provide continuous (automated) aggregation functions/tables?

I read that InfluxDB offers continuous aggregation features. Does Clickhouse provide something along those lines? For example, I have certain real-time measurements arrive every couple seconds, ...
Matt's user avatar
  • 7,004
0 votes
2 answers
47 views

return rows with unique values in two columns, not just unique rows

I have a situation akin to an order table and an invoice table. The link between them should be 1:1 however, due to systemic error, the order numbers for some invoices get lost. This causes me pain ...
emsfurmogin's user avatar
1 vote
1 answer
32 views

What is the better and optimal way to find the key (can be n-level nested ) is present in the mongoDB collection?

Let us take my document in collection looks like this bellow { "data": [ { "MainId": 1111, "firstName": "Sherlock", ...
Divakar V's user avatar
-1 votes
1 answer
20 views

Can an association be non-composition and non-aggregation?

I have heard that aggregation and composition are parts of association (If we are talking about OOP). But there is a occasions where we can't name one like an assotiation or aggregation? I've read ...
Lucy's user avatar
  • 7
1 vote
1 answer
428 views

How to vectorize complex cumulative aggregation problem?

Dataset: date time_index identifier value cum_value bar_index desired_output 2023-06-01 1 stackoverflow 5 5 NaN 0 2023-06-01 2 stackoverflow 10 15 NaN 0 2023-06-01 3 stackoverflow 10 25 NaN 1 ...
Kevin Li's user avatar
0 votes
0 answers
15 views

The right way to compare Long type in MongoDB aggregation

I have a MongoDB collection with the data like this: { "_id": { "$oid": "61374ec2d53afa0368df9a39" }, "UUID": "3c113734-4249-448b-96bc-...
Vitaly Motov's user avatar
0 votes
0 answers
18 views

Elasticsearch, how to do a must_not with a nested_field in the filter context of aggregation section?

In my index, I have the following documents { "_id" : 1, "_source" : { "in_stock" : false, "warehouses" : [ { ...
toch's user avatar
  • 67
0 votes
2 answers
31 views

How to create embedded array of documents and further create embedded document on each element

I have three mongoDB collections and their respective documents namely; mosques, prayers and subscriptions as follows: mosque document: { "_id": "64a48ce14ebcac9ec9a3b0b9", &...
Bello Shehu's user avatar
0 votes
1 answer
35 views

mongodb $cond with $arrayElemAt as false condition inside aggregation

I'm inside the $project step. { 'res' : {$cond: [ {$or: [{'$lte' :['$list', null]}, {$eq: ['$list', []]}] }, '$root_field', {'$arrayElemAt': ['$list.obj.field', 0]]}} ...
Marco's user avatar
  • 322
1 vote
0 answers
28 views

MongoDB: Aggregation - Implementing geo location with mongodb

Just some clarification with my implementation in mongodb aggregation. I'm having an issue with my implementation. "$geoNear is only valid as the first stage in an optimized pipeline" const ...
user22162963's user avatar
0 votes
0 answers
30 views

Aggregations for SharePoint 2019 Library using CAML Query

I have the following code to read to SUM of Total, PaidAmount, and ForgivenAmount from SharePoint 2019 Library named Invoice. public void GetTotalsForClient(int clientID, DateTime startDate) { ...
Nikhil Chavan's user avatar
0 votes
0 answers
27 views

How to concatenate messages from multiple rows that surpass the varchar2 limit

In the system I have a very big message that contains are over 4000 characters encoded in varchar2 and therefore they are split into multiple messages/rows, usually 2-3, where only the last one has ...
Filip's user avatar
  • 183
0 votes
0 answers
40 views

Best way to make a complex Kibana Metric ( filter out buckets value on a condition then count the remaining values in tha bucket )

I stumbled across an issue I cannot resolve and I have no idea how to continue from here. My initial situation is simple : I have logs of 'problems' every minute in this format : ID|Status. Open logs ...
Lucas Enard's user avatar
0 votes
1 answer
31 views

Excluding "0" values from MongoDB Compass aggregation result

I'm performing an aggregation in MongoDB Compass, and I want to exclude the values of "0" from the result. Currently, my aggregation returns the following date value: "1948-12-08 00:00:...
alanandrade01's user avatar

1
2 3 4 5
68