mongolite icon indicating copy to clipboard operation
mongolite copied to clipboard

Query Issue with Aggregation

Open koushiksaha89 opened this issue 8 years ago • 2 comments

Same query in mongo shell returns results but with mongolite i'm getting zero documents. Below is the query mon$aggregate('[{"$group":{"_id":{"Source":"$SourceId","Destination":"$DestinationId"},"Count":{"$sum":1}}},{"$sort":{"Count":-1}}]')

Am i doing anything wrong?

koushiksaha89 avatar May 25 '17 07:05 koushiksaha89

Hi,

I had the same issue when I tried to use it. I think this isn't from a mongolite issue but from jsonlite when you use mongo aggregate mongo return a JSON texte with a table like:

[{"Source": 1, "Destination":2, "Count":3}, {"Sou... }]

And fromJSON function in jsonlite package don't now how to convert that into a dataframe, so you get nothing.

JeremyBesson avatar Jul 18 '17 12:07 JeremyBesson

Someone already open the jsonlite issue here : https://github.com/jeroen/jsonlite/issues/192

JeremyBesson avatar Jul 18 '17 12:07 JeremyBesson