Welcome
Login
Sign up
Home
Solutions
Forums
How can we help you today?
Enter your search term here...
Search
Login
or
Signup
to submit a new ticket
Check ticket status
Start a new topic
Discussions
Kinvey Forums
JavaScript
Combine contains query with grouping
p
p6n
started a topic
over 6 years ago
I am using AngularJS:
I want to combine a contains query with grouping. Seperately, everything works, however, the following doesnt (no results):
var query = new $kinvey.Query();
query.contains('field', fieldsArray);
var group = $kinvey.Group.count('field');
group.query(query);
$kinvey.DataStore.group('collection', group).then(function(res) {
console.log(res);
});
As I said, the following DOES work (desired result):
var query = new $kinvey.Query();
query.contains('field', fieldsArray);
$kinvey.DataStore.find('collection', query).then(function(res) {
console.log(res);
});
The grouping alone works as well.
Any ideas?
3 Comments
Oldest First
Popular
Newest First
Sorted by
Oldest First
M
Mark
said
over 6 years ago
What data is in the `fieldsArray`? Just values, or ids of some kind?
p
p6n
said
over 6 years ago
It's values. And as I said, it DOES work without grouping. Only together they dont.
M
Mark
said
over 6 years ago
Can you paste the output of `JSON.stringify(group)` here so I can try and reproduce?
Login
or
Signup
to post a comment
More topics in
JavaScript
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
p6n
I want to combine a contains query with grouping. Seperately, everything works, however, the following doesnt (no results):
var query = new $kinvey.Query();
query.contains('field', fieldsArray);
var group = $kinvey.Group.count('field');
group.query(query);
$kinvey.DataStore.group('collection', group).then(function(res) {
console.log(res);
});
As I said, the following DOES work (desired result):
var query = new $kinvey.Query();
query.contains('field', fieldsArray);
$kinvey.DataStore.find('collection', query).then(function(res) {
console.log(res);
});
The grouping alone works as well.
Any ideas?