Closed atulatgithub closed 8 years ago
Code of this form works just fine:
var Cloudant = require('cloudant');
var cloudant = Cloudant({ url: "https://reader.cloudant.com"});
var mydb = cloudant.db.use('abcde');
mydb.view('test','newview', { group_level:2, reduce:true}, function(err, data) {
console.log(err, JSON.stringify(data));
});
Not working. Still returning 72k records.
mydb.view('test','newview', { group:true, group_level:2}, function(err, data) { console.log(err, JSON.stringify(data)); });
Sorry for both of you. Some silly issue from my side. I forgot that my view has complex keys. First key is an array of [Brand, Model, State, City etc]
I want to group by Brand or Brand/Model or Brand/Model/State. Is this possible?
Below is example. I want to group by first key elements. i.e by My view is like this [ [ "LG", "WD100CW", "Florida", "Coral Springs", "33067", "2016", "1", "2" ], "Saturday" ], value: { sum: 1, count: 1, min: 1, max: 1, sumsqr: 1 }
Really sorry to both of you.
Hello, I tried passing group_level to view using below syntaxes
params = { reduce: true, group_level: 2 } params = { "reduce": "true", "group_level":"2" }
However, cloudant is not grouping it. Its returing around 72k records. If I test it through browser its its returning correct records.
@glynnbird