top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

MongoDB: run aggregation queries in json string format in java app

0 votes
411 views

I have an aggregation query given below which I need to pass in as a json string to java app to execute it. Is it possible to do that -

{$unwind:$results},{$match:{result.studentid:11}}

I tried using BasicDBObject.parse but it is returning me the unwinded or flattened results and the result is not segregating on the basis of match.

Is there any other way to do it.

posted May 24, 2018 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+1 vote

I use nodejs with mongoDB and I want to insert JSON data into mongo, I use mongoose but I don't wanna to use model and shéma just push different json with different shéma.

Can someone tell me how I can do it ?

+2 votes

I have an use case where I have find all the matching records and apply the aggregation like count, sum, group by etc .
Can I use such scenarios where I have to use find and aggregate function together or should I find then get the cursor object and have to perform aggregation operation separately

+1 vote

I am new to Mongodb.I jave a C code which generates output in JSON format(json file) and is stored on Ubuntu on my Virtual machine. I need to push the data in JSON file onto Mongodb using C programming.I am able to establish connection to mongodb through C code. Please let me know the Command through which JSON file data can be stored onto mongodb through C programming.

+1 vote

I am having collection with 127706 document. In aggregation pipeline i having 2 group stages. It is giving me result in 1.5 sec.

To optimize it to more I have created index on the fields which I am using in match stages with no success. Is their any to optimize aggregation performance in more way?

I m using mongodb 3.2.1?

...