As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
Hi, I am having a couple issues when aggregated/grouping the results based on a field. Please see the issues below:
1) When aggregating/grouping based on a specific field in my collection, my reduce condition (WHERE clause in sql) isn't actually working. The way it is writing in the HTML5 guide gives me an error and the other way I tried just doesn't reduce the output. The blue text below is the syntax from the guide that gives me an error. I replaced the blue with the orange code and it resolves the error, but doesn't actually reduce anything.
var userFlashDataStore = Kinvey.DataStore.collection('UserFlash');
var userFlashQuery = new Kinvey.Query();
userFlashQuery.equalTo('resultPass', false);
var aggregation = Kinvey.Aggregation.count('flashcard');
aggregation.query(userFlashQuery); //This is the syntax from the guide but gives an error.
aggregation.userFlashQuery; //Doesn't give error, but this doesn't actually reduce the output by the query
var stream = userFlashDataStore.group(aggregation); //The rest is working based on the guide syntax
....
2) Secondly, I am wondering how I can aggregate/group data based on a property in a referenced object. For example, if I have a object with a userID and object A (embedded). How can I group my output by a property within object A?
Thanks in advance!
James
Best Answer
P
Pranav J
said
over 6 years ago
James,
Please use the following code snippet to set a query for an aggregation:
var userFlashDataStore = Kinvey.DataStore.collection('hotels');
var userFlashQuery = new Kinvey.Query();
userFlashQuery.equalTo('searchable', false);
var aggregation = Kinvey.Aggregation.count('searchable');
aggregation.query = userFlashQuery;
1. The error is: "Uncaught TypeError: aggregation.query is not a function"
2.
3. I am using SDK 3.4.1
Thanks,
James
P
Pranav J
said
over 6 years ago
James,
I am able to reproduce this issue. I have escalated this to engineering and will get back to you once I have more information to share.
Thanks, Pranav Kinvey MLIBZ-1758
J
James Seils
said
over 6 years ago
Thank you Pranav,
Would you be able to help with my second question?
2) Secondly, I am wondering how I can aggregate/group data based on a property in a referenced object. For example, if I have an object with a userID and object A (embedded). How can I group my output by a property within object A?
I would like the results be:
userID, ObjectA.Property1, Count
Do you know if this is possible?
Thanks,
James
P
Pranav J
said
over 6 years ago
Answer
James,
Please use the following code snippet to set a query for an aggregation:
var userFlashDataStore = Kinvey.DataStore.collection('hotels');
var userFlashQuery = new Kinvey.Query();
userFlashQuery.equalTo('searchable', false);
var aggregation = Kinvey.Aggregation.count('searchable');
aggregation.query = userFlashQuery;
James Seils
Hi, I am having a couple issues when aggregated/grouping the results based on a field. Please see the issues below:
1) When aggregating/grouping based on a specific field in my collection, my reduce condition (WHERE clause in sql) isn't actually working. The way it is writing in the HTML5 guide gives me an error and the other way I tried just doesn't reduce the output. The blue text below is the syntax from the guide that gives me an error. I replaced the blue with the orange code and it resolves the error, but doesn't actually reduce anything.
var userFlashDataStore = Kinvey.DataStore.collection('UserFlash');
var userFlashQuery = new Kinvey.Query();
userFlashQuery.equalTo('resultPass', false);
var aggregation = Kinvey.Aggregation.count('flashcard');
aggregation.query(userFlashQuery); //This is the syntax from the guide but gives an error.
aggregation.userFlashQuery; //Doesn't give error, but this doesn't actually reduce the output by the query
var stream = userFlashDataStore.group(aggregation); //The rest is working based on the guide syntax
....
2) Secondly, I am wondering how I can aggregate/group data based on a property in a referenced object. For example, if I have a object with a userID and object A (embedded). How can I group my output by a property within object A?
Thanks in advance!
James
Please use the following code snippet to set a query for an aggregation:
Thanks,
Pranav
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstPranav J
Thanks,
Pranav
Kinvey
James Seils
1. The error is: "Uncaught TypeError: aggregation.query is not a function"
2.
3. I am using SDK 3.4.1
Thanks,
James
Pranav J
I am able to reproduce this issue. I have escalated this to engineering and will get back to you once I have more information to share.
Thanks,
Pranav
Kinvey
MLIBZ-1758
James Seils
Thank you Pranav,
Would you be able to help with my second question?
2) Secondly, I am wondering how I can aggregate/group data based on a property in a referenced object. For example, if I have an object with a userID and object A (embedded). How can I group my output by a property within object A?
I would like the results be:
userID, ObjectA.Property1, Count
Do you know if this is possible?
Thanks,
James
Pranav J
Please use the following code snippet to set a query for an aggregation:
Thanks,
Pranav
-
How do I use Kinvey in my web app?
-
Is it safe to include keys/secrets in my client-side JavaScript app?
-
Why is the activeUser null even though I am logged in?
-
Login does not work even though credentials are valid.
-
Social login doesn’t work.
-
Appending objects to an Array (HTML5 - JS)
-
New to node.js - need bootstrap to downloadfiles from Kinvey
-
Problem with Aggregation/Grouping
-
Internal Server Error using Twitter Sign Up
-
Data Store
See all 315 topics