Async Aggregate APIs not working with DB version 3.0.12.

32 views
Skip to first unread message

Chandramouli Putta

unread,
Jun 22, 2016, 5:29:52 AM6/22/16
to mongodb-user
Hi,

I am trying to use the aggregate APIs to retrieve data from mongo collections. I have tried to execute the aggregate API against my local mongodb installation (version 3.2.6) which worked perfectly. When I tried to execute the same code against mongodb installation in another remote box (3.0.12), it didn't give me any results.

And I am using Mongo DB Async Driver version as (3.2.2)

                      <dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-async</artifactId>
<version>3.2.2</version>
</dependency>

I am not getting any clues from the documentation about when the aggregation API is introduced in the Async driver API. Is this issue due to some version incompatibility?

Best Regards,
Chandra.

Jeff Yemin

unread,
Jul 11, 2016, 10:58:03 AM7/11/16
to mongodb-user
The aggregate command was introduced prior to the 3.0 release.

Whey you say it didn't return any results, do you mean that the cursor was empty or that the callback returned an exception?  If the latter, what is the exception?

Also, please provide sample code that includes the aggregation pipeline that you're using.  Perhaps the issue is with a particular stage or expression.  To rule this out, you also might try it with an empty pipeline.


Regards,
Jeff

Chandramouli Putta

unread,
Jul 13, 2016, 8:42:12 PM7/13/16
to mongod...@googlegroups.com
Hello Jeff,

This is what I tried.

myCollection.aggregate(Arrays.asList
                              (Aggregates.match(Filters.eq("sessionId", "someId")),
                                  (Aggregates.project(Document.parse("{sessionIdentity: '$sessionId',"
                                      + "sessionName: '$sessionName',"
                                      + "chassisId: '$chassisId',"
                                      + "topSpeedPerSession: {$max: ['$speedLog.speed']}}"))
                              ))).forEach(document -> {

I didn't face any problems though. It didn't give any results either.

But the same is working in 3.2.6 version.


Thanks & Regards,
Chandramouli P,

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/jqpMxfRzhKo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/84fde0f6-4bdf-415d-ad44-487aa668c271%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages