When I run my n1ql query using the nodeJS SDK, I always get different results ranging from ~3000-5000 resultCount. But when I run the same query in the query console, I always get the expected resultCount of ~8500.
Can someone please point me to where I should fix the issue? I’m running 4.5.1-2844 Community Edition.
And here’s a snippet of what I use against the nodeJS SDK
var query = n1ql.fromString("
SELECT
merc.first_name || " " || merc.last_name AS name,
merc.area, merc.fmas, merc.channel, merc.designation,
answer.topic,
answer.module_name,
MILLIS_TO_ZONE_NAME(answer.date_created, ‘Asia/Manila’) AS date_taken,
answer.score,
answer.question_count,
(answer.score/answer.question_count * 100) AS percentage,
answer.passed AS status
FROM ami_training AS merc
LEFT OUTER JOIN ami_training AS answer ON KEY ‘User|’ || answer.owner FOR merc
WHERE
merc.type=‘User’ AND merc._deleted IS MISSING AND (merc.is_active IS MISSING OR merc.is_active)
AND answer.type=‘Answer’ AND answer.year=2018 AND answer.quarter=1 AND answer._deleted IS MISSING
ORDER BY merc.last_name";
bucket.query(query, function(err, data) {
// handle response
});
They’re exactly the same statement but nodeJS responses vary between 3k and 5k responses.
Thanks!
Hi, interesting. If you’re seeing differing numbers of results each time then it feels like a timeout or similar. Have you tried bumping the log level to see if there are any clues there? (e.g. LCB_LOGLEVEL=5 node index.js)