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
49
votes
3 answers

How to do basic aggregation with DynamoDB?

How is aggregation achieved with dynamodb? Mongodb and couchbase have map reduce support. Lets say we are building a tech blog where users can post articles. And say articles can be tagged. user { id : 1235, name : "John", …
36
votes
5 answers

(MongoDB Java) $push into array

I'm using mongo 2.2.3 and the java driver. My dilemma, I have to $push a field and value into an array, but I cant seem to figure out how to do this. A sample of my data: "_id" : 1, "scores" : [ { "type" : "homework", "score" :…
notorious.no
  • 4,919
  • 3
  • 20
  • 34
18
votes
4 answers

MAX(), DISTINCT and group by in Cassandra

I am trying to remodel a SQL database Cassandra such that, I can find the Cassandra equivalent for the SQL queries. I use CQL 3 and Cassandra v1.2. I modeled the db design in cassandra so that it supports the order by clauses and denormalized tables…
eldho
  • 255
  • 1
  • 2
  • 13
16
votes
2 answers

Multiple group-by in Elasticsearch

I need to aggregate (group-by) using 3 fields in ES. Can I do that in 1 query or that I need to use a facet + iterate for each column? Thank you
kambi
  • 3,291
  • 10
  • 37
  • 58
10
votes
1 answer

$lookup with same collection

I am new to MongoDB so I am not sure if I have phrased my question correctly. I have a collection in which data looks like this: { "_id" : ObjectId("66666"), "Id" : 994, "PostType" : 1, "AnswerId" : 334, "CreationDate" :…
9
votes
3 answers

Using Cassandra for OLAP

We are using Cassandra for OLTP DB, storing DB transactions, and evaluating requirements for reporting solution. We are evaluating using Cassandra for reporting database with flattened schema. What are the advantages/ pitfalls for using Cassandra…
Amit Kaneria
  • 5,466
  • 2
  • 35
  • 38
6
votes
3 answers

Aggregation on fixed size JSONB array in PostgreSQL

I'm struggling doing aggregations on a JSONB field in a PostgreSQL database. This is probably easier explained with an example so if create and populate a table called analysis with 2 columns (id and analysis) as follows: - create table analysis ( …
bobmarksie
  • 3,282
  • 1
  • 41
  • 54
5
votes
3 answers

Can MongoDB documents processed by an aggregation pipeline be affected by external write during pipeline execution?

Stages of MongoDB aggregation pipeline are always executed sequentially. Can the documents that the pipeline processes be changed between the stages? E.g. if stage1 matches some docs from collection1 and stage2 matches some docs from collection2 can…
Rasto
  • 17,204
  • 47
  • 154
  • 245
5
votes
1 answer

How to write MongoDB query that find multiple paths

Here is the collection with which I working: - sign1: A1 - sign2: A2 - sign1: A2 - sign2: A5 - sign1: A2 - sign2: A6 - sign1: A2 - sign2: A8 - sign1: A5 - sign2: A8 The query should find the path from A1 to A8 for example, it should…
5
votes
1 answer

Cassandra: Argument types do not match

I am a newbie to Cassandra and created a generic repository for my Cassandra database using linq. For my Single() method, I am passing the where criteria as a parameter. This is my Single method: Single(Expression> exp) This is the…
user1790300
  • 2,143
  • 10
  • 54
  • 123
5
votes
1 answer

$out in aggregation MongoDB

Can anyone explain me why in Java when i do an aggregation pipeline with "$out" don't write the result in the new collection when i write only this: Document match = new Document("$match", new Document("top_speed",new Document("$gte",350))); …
Milaci
  • 515
  • 2
  • 7
  • 24
4
votes
1 answer

MongoDB Atlas search: sort by "searchScore"

I run the following aggregation pipeline and it works well: [ { $search: { text: { query: text, path: 'name', fuzzy: { maxEdits: 2, prefixLength: 0, maxExpansions: 256, }, …
4
votes
1 answer

How can I perform nested "joins" (joining 3 or more collections) in a MongoDB aggregation pipeline?

Let's say we have 3 hypothetical collections in MongoDB: customers, orders, and orderItems. Each customer has multiple orders, and each order has multiple order items. Here's some sample data for these 3 collections: customers [ { …
4
votes
1 answer

How to use $update/ $set operator in aggregation pipeline mongodb?

I am trying to update a field called name in my coll1 collection based on certain criteria. I first created a create an aggregation pipeline that filters out documents based on my criteria. var local_filter = { "$or" :[ …
Anu
  • 3,198
  • 5
  • 28
  • 49
4
votes
1 answer

How to return elements with the most recent date in MongoDB

On MongoDB, how can I select elements with the most recent date from this list : [{ "_id" : ObjectId("5c5064f39d0c4b52cf6d1d55"), "Date" : "12-09-2018", "Type" : "A", "Value" : 73650.14 }, { "_id" : ObjectId("5c5064f39d0c4b52cf6d1d15"), "Date" :…
1
2 3
20 21