Hello I am performing a n1ql query, the query is a fine query and it returns data when I execute it in the workbench but when the sdk my application is trying to perform a the query it returns this
{} as the array of recods
null as the error
does anyone here have experienced this type of behavior?
I am using the node sdk.
Could you paste an example of the code that your application is executing to run the query, and show how you are using the SDK?
This is the Query I am executing.
SELECT * FROM Session_Bucket Session
NEST Events_Bucket aryEvents ON KEYS Session.aryEvents
LEFT NEST PageRule_Bucket aryPageRules ON KEYS aryEvents[*].causeId
WHERE Session.companyId = '4b602472-44e6-4c22-a674-047484d588b8'
AND NOT ANY Event IN aryEvents SATISFIES ANY rule IN aryPageRules SATISFIES
Event.result='form-completed' AND
Event.causeId=rule.ruleId AND
rule.pageGroup='homedefenders.com Quote Form'
END
END AND ANY rule IN aryPageRules SATISFIES rule.pageGroup='homedefenders.com Quote Form' END AND Session.aryBreStatus.homedefendersQuoteBreadId IS MISSING AND Session.lastEventTime < (NOW_MILLIS() - 300000) LIMIT 300;
Here is how I execute the query
C_BaseDao.prototype.mf_executeN1ql = function (p_strN1ql, pf_callback)
{
try {
var l_oQuery = this.m_n1qlQuery.fromString(p_strN1ql);
if (g_oConfig.m_bTestMode) {
l_oQuery.consistency(this.m_n1qlQuery.Consistency.STATEMENT_PLUS);
}
this.m_oPrimaryBucket.query(l_oQuery, pf_callback);
} catch (p_exception) {
if (g_DBConnection.E_couchbaseMessages.shutdownBucket === p_exception.message) {
// TODO: Remove this before launch.
console.log("Re-opening shutdown bucket. " + this.mf_getBucketName());
g_DBConnection.mf_reconnectAll();
this.m_oPrimaryBucket = g_DBConnection.m_aryBuckets[this.mf_getBucketName()];
this.mf_executeN1ql(p_strN1ql, pf_callback);
} else {
console.log("exception in execute n1ql");
console.log(p_exception);
pf_callback(p_exception, null, null);
}
}
};
this.mf_executeN1ql(l_strSelect, lf_parseResults);
My Bucket timeout Settings are the following.
C_CouchbaseCluster.prototype.mf_connectBucket = function (p_strBucketName, pf_errorHandler)
{
if (!g_oHelper.mf_isValid(this.m_aryBuckets[p_strBucketName]) || false === this.m_aryBuckets[p_strBucketName].connected) {
this.m_aryBuckets[p_strBucketName] = this.m_oCluster.openBucket(p_strBucketName, this.mf_generateErrorHandler(pf_errorHandler));
this.m_aryBuckets[p_strBucketName].operationTimeout = 600 * 1000;
this.m_aryBuckets[p_strBucketName].connectionTimeout = 600 * 1000;
this.m_aryBuckets[p_strBucketName].enableN1ql(g_cfgDatabase.m_strCouchbaseHostname);
}
return this.m_aryBuckets[p_strBucketName];
};
I should mention that the query takes a while to execute.indent preformatted text by 4 spaces