Java runCommand cursor document , to driver cursor object

Hello

When i run a aggregate method of the driver i get a AggregateIterableImpl
How to get the same using runCommand({“aggregate” …})
Or with any command that returns cursor like “find” etc

I want to convert runCommand that return a cursor document ,to a Java driver cursor.
Its important because without we cant run any command that return cursor.

I am looking for how the java driver does it in code,but i haven’t found it.

Thank you

Hi there,

There is no way to do this with the public driver API. Can you explain your use case, and what prevents you from using the existing helper method for aggregate?

Regards,
Jeff

Its useful when someone gives us a MQL command to run
Without it runCommand is only for commands that dont return cursors

I personally need it because i am making a query builder that generates
MQL commands and i want to get the results in a java driver cursor

runCommand(myQueryGenerator()) => java driver cursor

I know its possible to use getMore etc,but the point is to give those
results to a java user,to use them as he already knows.

i am reading the code of the java driver , is it hard to make it?
any help appreciated

There is no way to do it with the current public API of the driver.

I’m still not clear from your description why you need to generate the full command document. Your best bet is to generate just the aggregation pipeline and use the driver’s existing aggregate helper.

Regards,
Jeff

Thank you for the reply,i will go for the pipeline only,the big part is the pipeline,i was thinking that also now.
But in general i believe it would be useful,to have it,commands are the same in all drivers,
and it would be helpfull to be able to run them all with runCommand