Node sdk : An unknown N1QL error occured. This is usually related to an out-of-memory condition

I have a simple query to retrieve a certain type of Documents from the bucket.

for eg : Select * from flight where type = ‘Flight’;

Bucket Document Size 2,800,000

There is a primary index on this bucket.

Below it outcome of node execution.

node --max_old_space_size=4096 flight.js
events.js:154
throw er; // Unhandled ‘error’ event
^

Error: An unknown N1QL error occured. This is usually related to an out-of-memory condition.
at /Users/ewan/node_modules/couchbase/lib/bucket.js:680:15

Further details are available at the following thread: