Questions tagged [aggregation]
Aggregation is a relationship between two classes that is best described as a "has-a" and "whole/part" relationship.
3,087
questions
0
votes
1
answer
24
views
Getting count of total documents when using aggregation along with skip and limit [duplicate]
How can I get the total count of documents when using the aggregation along with limit and skip like in the following query?
db.Vote.aggregate({
$match: {
tid: "e6d38e1ecd&...
0
votes
0
answers
14
views
wrong result of aggregation pipeline in mongoDB
I am new To NodeJS and MongoDB. I want to fetch data from the multiple table using aggregation pipeline. SO My table structure is like this :
Category :
_id, category_name, ...
Product :
_id, ...
0
votes
1
answer
17
views
How to aggregate timestamp data in Spark to smaller time frame
I'm working on a project using New York taxi data. The data contain records for pickup location (PULocationID), and the timestamp (tpep_pickup_datetime) for that particular pick-up record.
I want to ...
0
votes
0
answers
15
views
How do I add an attribute in a SAX2 handler using xerces C++
I'm using xerces C++ SAX2 handler to process xml elements. The handler has access to the attributes but not the element. So there is no way to add an attribute in order to use the attributes data ...
0
votes
0
answers
13
views
How to update the small content of a mongodb field using updateMany and replace method?
Here's the example
{
name:"John",
emailId:"johncoderq@gmail.com"
}
And I wanted to change the emailId to johncoder@gmail.com .
Here I want to update this record by querying ...
2
votes
2
answers
29
views
Expand expression in Spark Scala aggregation
I'm trying to convert a simple aggregation code from PySpark to Scala.
The dataframes:
# PySpark
from pyspark.sql import functions as F
df = spark.createDataFrame(
[([10, 100],),
([20, 200],)]...
0
votes
0
answers
17
views
Customize Ag-Grid aggregation
I did try to create Ag-Grid with aggregation for accounting purposes. And I have strange requirements.
I have a column with positive numbers, next column contain (credit) and (debit) which must work ...
0
votes
1
answer
32
views
elastic search sort after aggregation
I have an elastic search query showing distinct value for [Have CVID], for each CONTACT_ID, and I want to sort by [Have CVID] count after aggregation. Where can I add the sort by here?
POST /dashboard/...
0
votes
1
answer
32
views
Distinct Count Totals Incorrect When new Column (Dimension) Added
I have a query where I need to count a field to come up with a value for 'delivery stops' as shown below:
SELECT
[EAR_START_DTTM_H],
cast(year([EAR_START_DTTM_H]) as varchar(4)) + right('0' ...
0
votes
0
answers
16
views
Groupby on custom column and time with SQL
I have a following dataset:
collection_time
col_a
col_b
2022-06-27 14:15
20
15
2022-06-27 14:13
-1
-1
2022-06-26 20:15
21
47
I would like to have the following output:
collection_time
...
1
vote
2
answers
63
views
SQL Server: select from table with/without aggregate columns using groupby
I have the columns and rows for the table A,
tableid
featureid
col3
col4
coldatetime
1
1
AD
4
2022-06-22 09:00:00
2
2
BC
5
2022-06-22 09:00:00
3
1
AE
6
2022-06-22 10:00:00
4
3
BD
7
2022-06-22 11:...
0
votes
1
answer
39
views
MongoDB conditional aggregation with unwind
I have db collection like:
{
"_id" : "af5c00e4-d3a8-419d-8793-c0cf328802ec",
"collaborators" : [
{
"_id" : "9bd2eee8-bf6c-4c6f-...
1
vote
1
answer
29
views
mongodb extract values from a double nested object
My data has this structure:
[
{
name: 'parent1',
children:{
child1:{ age:12, isSomething: true },
child2:{ age:13, isSomething: false },
child3:{ age:12, isSomething: true }...
0
votes
1
answer
29
views
Why do I get a naming convention error in PySpark when the name is correct?
I'm trying to groupBy a variable (column) called saleId, and then get the Sum for it, using an attribute (column) called totalAmount with the code below:
df = df.groupBy('saleId').agg({"...
0
votes
2
answers
39
views
Snowflake: Aggregating by a sliding window (the past 60 mins) for a dataset where the sampling frequency is non-uniform
I have data with non-uniform sampling dist. I want to the aggregate data on a rolling/ sliding basis (the past 60 mins).
In order to achieve an hourly average (partitioned by city), I used to ...
0
votes
0
answers
22
views
Elasticsearch max sequence for type
I have a csv file with information like this:
height,width,length,type
88,36,60,light
22,47,68,maximum
81,26,28,medium
I need to index this info into elasticsearch with adding sequence field. ...
0
votes
2
answers
103
views
Linq group the columns combination to a two list
I have question about how I could use Linq grouping the same combination that the list has then relate to a two list.
Example:
I have theses classes.
public class PetCategoryOwner
{
public string ...
1
vote
1
answer
27
views
Get members in aggregation bucket ElasticSearch
I'm pretty new to elasticsearch
I have a class called SubRequest
Mapping:
{
"sub-request" : {
"aliases" : { },
"mappings" : {
"properties" : {
...
1
vote
1
answer
47
views
why the aggregation query's result is null in mongodb?
why the result is null?
i have this as my collection, the result shoul be contain the product and the average of quantity, match by year.
this is my collection
{
"order":"o1",
...
0
votes
0
answers
15
views
Faceting before collapse in Solr
I am using CollapseQueryParser Plugin in Solr to collapse results across one common field.
Quoting the official Solr Documentation -
This parser collapses the result set to a single document per ...
0
votes
1
answer
17
views
How to calculate the size of an aggregation when limit of 16 mb is crossed
I want to calculate the size of a few interrelated documents in MongoDB for a particular application User.
I am performing aggregation and in the end doing projection on the bsonSize, but when the ...
1
vote
1
answer
37
views
Downscaling a tiff image by aggregating 5x5 pixels based on stats
How to downscale a tiff image of 10m resolution and create a new image of 50m where each pixel is stats from the first image?
The initial tiff image is a binary classification map - meaning each pixel ...
0
votes
0
answers
36
views
Aggregate query with lookup is works very slow | MongoDB
I have two collections. The first collection is distributors and the second collection is reports.
reports collection contains about 300K of data. I need to get the data for the specified time ...
0
votes
1
answer
28
views
Can you help me to correct this query in sql
SELECT
STUDENT_NAME, SUBJECT, TYPE_OF_DISTRIBUTION,
SUM(POINTS) * WEIGHT_IN_PERCENTAGE / (COUNT(POINTS) * 100)
FROM
assignments a
JOIN
distributions d ON a.TYPE_OF_DISTRIBUTION = d....
0
votes
1
answer
20
views
Mongo 5 findOneAndUpdate aggregation pipeline for default counter value?
Theres a several old questions (2015/2016) about doing an upsert with $inc that has a default value. The consensus seemed to be do multiple DB calls. I'm hoping there is a more modern approach to this ...
0
votes
0
answers
18
views
Is it possible to group up all documents returned from a query into a dictionary-like structure based on one of their fields? [duplicate]
The title probably doesnt help much, but let me illustrate what im asking.
I have a mongodb database with a collection of statements and a collection of units.
Each statement document has a field ...
0
votes
3
answers
53
views
How to merge two mongodb query into one
I have two mongodb aggregate query as shown below.
The below query gives me the count of total failed and the sectionType
db.Departments.aggregate([
{
$match: {$and: [{"subject.failed&...
0
votes
1
answer
17
views
Elasticsearch Aggregation of large list
I'm trying to count how many times ingredients show up in different documents. My index body is similar to this
index_body = {
"settings":{
"index":{
"...
0
votes
1
answer
31
views
Mongodb aggregation nested lookup
I have 3 collections as follows:
GroupRoles Collection:
//1
{
"_id": ObjectId("62a384ee0c4dbafc64000fba"),
"name": "GroupRole template 1",
"...
0
votes
0
answers
21
views
Elasticsearch Error get aggregation top_hits source
So I'm trying to achieve the top_hits value to be aggregated in bucket_script but I got the errors like this
{
"error": {
"root_cause": [
{
&...
0
votes
1
answer
25
views
Elasticsearch to SQL equivalent, get the first and last documents with filter
I have an issue with elasticsearch documents. So the goal is I need to get the latest data close from index stocks and also the last data close from stocks within a specified date. Here's the example ...
0
votes
1
answer
36
views
How to turn a MongoDB query into a dictionary
I have a collection in my MongoDB:
{ userId: 1234, name: 'Mike' }
{ userId: 1235, name: 'John' }
...
I want to get a result of the form
dict[userId] = document
in other words, I want a result that ...
0
votes
0
answers
12
views
How to sort buckets in Elasticsearch on their first occurrence in a search
I have an Elasticsearch query (version 7) that returns a paged result of products.
The query has a specific sort on multiple fields:
Product A - image 1
Product B - image 1
Product C - image 2
...
0
votes
2
answers
37
views
How to fetch a single record of a field from a document in MongoDb using Java(with the help of query not Loop)
{
"_id" : "0289f117-54b7-451c-915c-c7948dbad22c",
"approvers" : [],
"reviewers" : [],
"cvoReviewers" : [],
"payer" : "medicaid",
&...
0
votes
1
answer
19
views
Aggregations in VisualStudio 2019 // SSAS
We have VS 2019 for SSAS development (with installed SSDT).
I would like to create aggregations for measures in order to increase query performance (cube with tabular model).
Could you tell, please, ...
0
votes
0
answers
30
views
Calculate DateAdd in aggregation SQL subquery in SQL Server
I created a subquery inside my select statement which aggregates multiple columns into one which then is called [maxBoosterDatum]. Now I need to perform a DateAdd calculation with the result of the ...
0
votes
1
answer
34
views
Group documents by shared field while also filtering by date
I have a several documents that represent transactions sharing the same reference. However, they all can have different dates. They would look kinda like this:
_id: ObjectId('xxxxxx')
reference: ...
0
votes
0
answers
6
views
Tableau Subtotal aggregation trouble
Having trouble with my view.
I have 3 columns:
A - total hours worked
B - Total Available Hours
C - Productivity (A/B in a calculated field)
When i click view Grand Totals, the Hours in A and B ...
0
votes
0
answers
26
views
python runtime 3x deviation for 32 vs 34 char IDs
I am running an aggregation script, which heavily relies on aggregating / grouping on an identifier column. Each identifier in this column is 32 character long as a result of a hashing function.
so my ...
0
votes
1
answer
20
views
Which one is good mongodb aggregate or mongodb functions
Which one is good mongodb aggregate or mongodb functions
what i mean to say : mongodb aggregation or mongodb functional which one is preforable and which one gives good performance.
0
votes
1
answer
34
views
how join parent with child of the same collection mongodb
I have the following collection called servicebyAff, where the parent collections are referenced
{
"_id" : ObjectId("53ed7efca75ca1a5248a281a"),
"category" : {_id,...
0
votes
1
answer
43
views
sailpoint IdentityIQ find connectors
I am new to sailpoint IdentityIQ.
How to find the connectors that filter out read-only entitlements during aggregation and certification please?
Thanks for your help!
0
votes
0
answers
12
views
Power BI dynamic Filters on group by
Im fairly sure what im attempting is not the ideal way to do things due to my lack of knowledge of power BI but here goes:
I have two tables in the form of:
One has the actual power against wind and ...
2
votes
2
answers
33
views
MongoDB: How to merge all documents into a single document in an aggregation pipeline
I have the current aggregation output as follows:
[
{
"courseCount": 14
},
{
"registeredStudentsCount": 1
}
]
The array has two documents. I would ...
0
votes
0
answers
25
views
mongodb aggregation multiple lookup
I want to aggregate Q & A collection.
Q & A is 1:m relation.
I did $lookup between user & question.
And then I am trying to do $lookup between question.answers & user.
But answers is ...
0
votes
1
answer
47
views
How to solve aggregation JSON documents
For every source_website_link, I want to find how many documents it has in MongoDB. I'm trying using aggregation.
sample of the documents:
{ "_id": { "$oid": "...
0
votes
0
answers
24
views
Query an array of linked documents in Mongo using aggregates
I have the following collections.
interface PartnerOrganization extends Document {
retailLocations?: RetailLocations[];
}
interface RetailLocation extends Document {
location: {
type: ...
1
vote
1
answer
33
views
Elastic Search return object with sum aggregation
I am trying to get a list of the top 100 guests by revenue generated with Elastic Search. To do this I am using a terms and a sum aggregation. However it does return the correct values, I wan to ...
0
votes
1
answer
40
views
How to cap the cardinality to some threshold with Elastic search
I'm trying to find the number of unique values when filtering over a given name,
the problem comes when the number of results is too big which increases the time to find the exact cardinality.
I ...
0
votes
2
answers
70
views
Apache Camel - split the list, call API and merge the body
I am new to Apache Camel and I would like to ask a few things. Basically, I want to call the API based on the resource ID list I have and combine all the responses from the API into one message. I ...