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
0
votes
1 answer

How to find Immediate Child of a node in mongo db

I have following Collection Location Collection [ {id : 1 name : 'l1' , 'location' : pune , parentLocation : Maharashstra}, {id : 2 name : 'l2' , 'location' : nashik , parentLocation : Maharashstra}, {id : 3 name : 'l3' , 'location' : mumbai ,…
0
votes
1 answer

In mongo DB, how do I grab multiple counts in a single query?

I'm currently trying to massage out counts from the mLab API for reasons I don't have control over. So I want to grab the data I need from there in one query so I can limit the amount of API calls. Assuming that my data looks like this: { "_id": { …
0
votes
0 answers

Unwinding a Mongo document and summing up fields

I have a document with the following structure { "_id" : ObjectId("7f68aab74df07a00a528a02b"), "T" : ISODate("2018-04-29T00:00:00Z"), "MP" : [ 1 ], "P" : 123, "PB" : 234, "CG" : 3, "d" : [ { "PS" : 432, "PL" : 765, …
0
votes
1 answer

Is Cassandra in memory i.e. 100% data is cache?

In cassandra sstables are stored on disk and memtable are in cache so is there is 100% conversion from sstable to memtable i.e. if 10 GB of sstable is there then will it required 10 GB of ram ?
0
votes
0 answers

MongoDb groupby count query

I have a mongoDB document having certain columns like Id, EmployeeID, SiteID, EmployeeAddress. A employee can be present at a site more than once. I want to have a group by query along with count which will give result set as EmployeeID SiteID…
Sarthak Jain
  • 31
  • 1
  • 1
  • 6
0
votes
0 answers

Are there any better ways joining two collections in MongoDB in Nodejs

I'm using nodejs with mongodb. Our team is currently building an simple android community application. As I am the server programmer, I want to know are there any better ways handling the database with mongodb. The picture above shows our…
AJH
  • 548
  • 1
  • 4
  • 10
0
votes
0 answers

How to join queries (not collections) in MongoDB?

I have multiple queries which all have a shared id. I am trying to join these queries into a single output but can not seem to figure it out. Any ideas? Thank you! Collection contains customers and sellers (id of each, date of sale, etc.). The…
0
votes
3 answers

MongoDB query to fetch list of documents with count of external linked documents

I have a mongodb database with collection documents that are approximately as follows: // user document { _id: $oid, name: "name", description: "description". // ... } // book document { _id: $oid, userId: "..." name:…
0
votes
2 answers

Weightage search in mongodb

Is there a way I can add weight-age to specific fields in Mongo-db without indexing? Document Format: { "_id" : "55b3551164518e48", "item" : "Item A", "price": 400, "added_date": "2015-07-22", "seller": "Seller A" },{ "_id" :…
0
votes
1 answer

Mongodb Aggregate lookup all products from one specific client

I have a Database from a .data and these collections: clientes, mercancias and vagones. I want to find all the data of mercancias from the same client. So in this case, "Electronica Chispas" has 2 "mercancia" entities in the database: [{"cliente":…
M.K
  • 1,464
  • 2
  • 24
  • 46
0
votes
1 answer

How to display the n x 2 values of the date in mongodb using aggregation?

I want to take 2n values from the database. In the below example I need to 2 points increment value in the mongodb database collection { "_id" : 1, "item" : "abc", "price" : 10, "quantity" : 2, "date" : ISODate("2014-03-01T08:00:00Z") } { "_id" :…
user8564341
0
votes
2 answers

Mongodb aggregation filter lookup on parent property

Given an object like this, how can I make it lookup users info only if the isAnonymous field is false? { "_id" : ObjectId(""), "user" : ObjectId(""), "title" : "This is an idea", "shortDescription" : "Pretty cool stuff", "downVoteCount" :…
0
votes
0 answers

Return only matched elements in MongoDB

I'm trying to "translate" a query from MySQL, SELECT a.Nome, a.PosicaoPrimaria, a.PosicaoSecundaria FROM Atleta AS a INNER JOIN Equipa AS e ON a.Equipa_idEquipa = e.idEquipa WHERE e.Localidade = 'Braga' AND a.PosicaoSecundaria != '' ORDER BY…
0
votes
1 answer

Is Apache Cassandra not a good choice for aggregations?

I read that cassandra would not provide sufficient possibilities for aggregations like SUM or AVG. Actually I thought the column oriented model would be the most appropriate for these kind of operations. I read many articles, but I am just not…
0
votes
1 answer

MongoDB Highest rated books, to display title

db.Books.aggregate( {$unwind:'$rating'}, //unwinds rating array {$group:{_id:"$ISBN",avgR:{$avg:'$rating.book_rating'}}}, {$sort : { avgR: -1 } } ).limit(5); This query returns top 5 highest rated books Collection is like: { …
CigarDon
  • 79
  • 1
  • 4
  • 14