Questions tagged [nosql-aggregation]

Questions related to Aggregation functions in NoSQL databases.

Questions related to Aggregation functions such as Count() or Sum() in NoSQL databases.

313 questions
4
votes
1 answer

MongoDB Count() vs. Aggregation

I've used aggregation in mongo a lot, I know performance benefits on the grouped counts and etc. But, do mongo have any difference in performance on those two ways to count all documents in a collection?: collection.aggregate([ { $match: {} …
dr.dimitru
  • 2,645
  • 1
  • 27
  • 36
4
votes
2 answers

How do you sort results of a _View_ by value in the in Couchbase?

So from what I understand in Couchbase is that one can sort keys* by using descending=true but in my case I want to sort by values instead. Consider the Twitter data in json format, my question is What it the most popular user mentioned? Each tweet…
chutsu
  • 13,612
  • 19
  • 65
  • 86
3
votes
1 answer

N1QL aggregation Query Couchbase

I'm trying to write a query that will aggregate results for documents for given day of week for a combination of source and target. Documents in the bucket look like this { "source": "test-source-1", "target": "test-target-1", "2022-03-05": { …
hjuk12
  • 111
  • 5
3
votes
0 answers

Update multiple object values inside array in MongoDB with different values without looping, but pure query

I want to update this document in MongoDB [ { "persons" : [ { "name":"Javier", "occupation":"teacher" }, { "name":"Juliana", "occupation":"novelist" }, …
Zefan
  • 31
  • 2
3
votes
3 answers

Filter nested array using projection without using unwind

I have my collection1 which holds the _ids of collection2 in projects field as follows: { "name": "adafd", "employeeId": "employeeId", "locations": [ "ObjectId(adfaldjf)", "ObjectId(adfaldjf)", …
3
votes
2 answers

MongoDB: How to populate the nested object with lookup query?

I am fetching list of records having some nested reference to other collection, I want to populate that nested ObjectId which is inside array of objects, with mongoDb aggregate lookup query. This is how DB collection structure is: { subject:…
3
votes
2 answers

Mogodb aggregation create output as {"key": "value"} from 2 arrays

I have a question about how to create output from 2 arrays one array with translation key and another with translation i would output as "translation_key":"value" Current output: { "_id" : ObjectId("5bfc0b2b30c4683f585078fb"), …
3
votes
2 answers

How to query a sub sub document in MongoDB?

Here is an example of the document I'm working on: { "_id" : ObjectId("5b35019563726438989381d3"), "ref" : "123", "nom" : "pc", "Revendeurs" : [ { …
Amira Bedhiafi
  • 8,088
  • 6
  • 24
  • 60
3
votes
1 answer

Merging time series in influxdb 0.9.x

I have a system which demands to monitor its metrics. In order to do that I use grafana + influxdb. The version of influxdb I currently use is 0.9.x. I want to be able to calculate some statistics. My use case is quite simple: I want to make a…
Roman Dryndik
  • 1,167
  • 1
  • 13
  • 34
3
votes
1 answer

Aerospike aggregation portion size

We are using "small" memory-only Aerospike server to store website analytics for last hour. Data size for last hour is about 10 Gb. We tried to execute some aggregation queries from separate server (Java-based client) on Aerospike, something like…
vlsergey
  • 254
  • 1
  • 10
3
votes
1 answer

Calculating collection stats for a subset of documents in MongoDB

I know the cardinal rule of SE is to not ask a question without giving examples of what you've already tried, but in this case I can't find where to begin. I've looked at the documentation for MongoDB and it looks like there are only two ways to…
Brian Shamblen
  • 4,653
  • 1
  • 23
  • 37
3
votes
1 answer

strange result when use Where filter in CQL cassandra

i have a column family use counter as create table command below: (KEY i use bigin to filter when query ). CREATE TABLE BannerCount ( KEY bigint PRIMARY KEY ) WITH comment='' AND comparator=text AND read_repair_chance=0.100000…
tnk_peka
  • 1,525
  • 2
  • 15
  • 25
2
votes
1 answer

performing a complex query in firestore for my ranking system

i want to create a ranked list of dishes in my neighborhood. so far i can rank the dishes by votes. // dish document structure { dish_id: SOME_ID, categories: ["Soup", "Noodles"], votes: [SOME_USER_ID_1, SOME_USER_ID_2, ...] } The query …
2
votes
1 answer

Count nested items conditionally in an aggregation

I am trying to count status occurrences in a MongoDB collection from two places. Given document like the one below, I would like to count status from the root of the document if there are no statues under statuses in one aggregation, but haven't…
Castyr
  • 380
  • 3
  • 14
2
votes
1 answer

OVER PARTITION equivalent in MongoDB

I've simplified the scenario for brevity. The initial data: | EngineerId | FirstName | LastName | BirthdateOn | CupsOfCoffee | HoursOfSleep | | ---------- | --------- | -------- | ----------- | ------------ | ------------ | | 1 | John …
Andrew K.
  • 23
  • 5
1
2
3
20 21