Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aggregate support in mongodb 3.6 #148

Closed
bckfnn opened this issue May 22, 2018 · 7 comments
Closed

Aggregate support in mongodb 3.6 #148

bckfnn opened this issue May 22, 2018 · 7 comments

Comments

@bckfnn
Copy link

bckfnn commented May 22, 2018

mongodb 3.6 removes the possibility to call aggregate command without specifying a cursor.

https://docs.mongodb.com/manual/release-notes/3.4-compatibility/index.html#deprecated-operations

so the old and well proven trick from

https://vertx.io/docs/vertx-mongo-client/java/#_running_other_mongodb_commands

no longer works. The returned "result" array no longer exists, but instead a cursor document with a firstBatch array is returned. Sending the GET_MORE command to retrieve the next batch seems not to be possible.

It seems to me that using aggregation with mongo 3.6 require active support from the Vertx.x MongoDB Client, f.ex. with an aggregate(..) method that returns a ReadStream similar to findBatch

@domenicoierullo
Copy link

Is there a trick to get around the problem?
I need help!

@karianna
Copy link
Contributor

karianna commented Jul 1, 2018

@johnoliver Any ideas?

@domenicoierullo
Copy link

No ideas! Sorry,

@HendrikLanghammer
Copy link

HendrikLanghammer commented Oct 31, 2018

This is how I worked around the problem for now:

1.) add the cursor to your command using a batch size larger than your maximum number of results:

JsonObject command = new JsonObject().put("aggregate", COLLECTION).put("cursor", new JsonObject().put("batchSize", 1000)).put("pipeline", pipeline);

2.) find your results in the new location:

JsonArray jsonArray = res.result().getJsonObject("cursor").getJsonArray("firstBatch");

Hope this saves someone a couple of minutes.

@vietj vietj modified the milestones: 3.x.x, 4.0.0 Nov 29, 2018
@ghost
Copy link

ghost commented Dec 4, 2018

What is the status of this enhancement?

@karianna
Copy link
Contributor

karianna commented Dec 4, 2018

I think this is resolved and will land in 3.6.1

@karianna karianna modified the milestones: 4.0.0, 3.6.1 Dec 4, 2018
@karianna karianna closed this as completed Dec 4, 2018
@limadelrey
Copy link

Is it on Vert.x's roadmap a reactive implementation of aggregate method (e.g. rxAggregate)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

7 participants