Hello,
I tested aggregate in NoSQL and pipeline works fine, however when I try the same aggregate from CC I get error:
{ "@class": ".GameSparksErrorResponse", "error": { "message": "Function aggregate does not accept parameters (object). (297193-event-testScanPQ#40)" }, "message": "Function aggregate does not accept parameters (object). (297193-event-testScanPQ#40)" }
My aggregate has pipeline consisting of $sort, $group, $group, $project and $sort.
In NoSQL this aggregate is tested on my runtime collection.
How can I make it work in CC?
Best regards
Hello Pádraig,
Thanks for answering. I resolved my issue already, I just applied what's written in reference for aggregate.
For anyone who would like to know, if you have more then one stage in your aggregate pipeline, for example: s1 = { $sort : { .... } }
s2 = { $match: { .... } }s3 = { $group: { .... } }
s5 = { $sort : { .... } }
Correct way to aggregate collection is:
Spark.runtimeCollection("someCollection").aggregate( s1, [ s2, s3, s4, s5] );
Thanks
aggregate
signature aggregate(JSON firstOp, JSON[] additionalOps)
returns JSONhttps://docs.gamesparks.com/api-documentation/cloud-code-api/cloud-data/sparkmongocollectionreadwrite.html
Thank you, Milutin!I had smashed my head trying to figure this out!But, where you find this in GS reference? URL please?
Great to hear, if you've any more questions feel free to let me know.
-Pádraig
Hi Milutin,
Can you show me your aggregation code in Cloud Code?
Just for example, I just tried this simple aggregation in Cloud Code and it worked fine.
var coll = Spark.runtimeCollection("playerList").aggregate({$sort:{"userName": 1}})
Cheers,
Milutin Cumic
Hello,
I tested aggregate in NoSQL and pipeline works fine, however when I try the same aggregate from CC I get error:
My aggregate has pipeline consisting of $sort, $group, $group, $project and $sort.
In NoSQL this aggregate is tested on my runtime collection.
How can I make it work in CC?
Best regards
Hello Pádraig,
Thanks for answering. I resolved my issue already, I just applied what's written in reference for aggregate.
For anyone who would like to know, if you have more then one stage in your aggregate pipeline, for example:
s1 = { $sort : { .... } }
s2 = { $match: { .... } }
s3 = { $group: { .... } }
s5 = { $sort : { .... } }
Correct way to aggregate collection is:
Spark.runtimeCollection("someCollection").aggregate( s1, [ s2, s3, s4, s5] );
Thanks
- Oldest First
- Popular
- Newest First
Sorted by Newest FirstJeff Amiel
aggregate
signature aggregate(JSON firstOp, JSON[] additionalOps)
returns JSON
https://docs.gamesparks.com/api-documentation/cloud-code-api/cloud-data/sparkmongocollectionreadwrite.html
Alexander Gats
Thank you, Milutin!
I had smashed my head trying to figure this out!
But, where you find this in GS reference? URL please?
Customer Support
Great to hear, if you've any more questions feel free to let me know.
-Pádraig
Milutin Cumic
Hello Pádraig,
Thanks for answering. I resolved my issue already, I just applied what's written in reference for aggregate.
For anyone who would like to know, if you have more then one stage in your aggregate pipeline, for example:
s1 = { $sort : { .... } }
s2 = { $match: { .... } }
s3 = { $group: { .... } }
s5 = { $sort : { .... } }
Correct way to aggregate collection is:
Spark.runtimeCollection("someCollection").aggregate( s1, [ s2, s3, s4, s5] );
Thanks
Customer Support
Hi Milutin,
Can you show me your aggregation code in Cloud Code?
Just for example, I just tried this simple aggregation in Cloud Code and it worked fine.
Cheers,
-Pádraig
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics