1
votes

I'm using arangodb cursor through javascript client

db._query('query', {param: value})

My query contains limit operator and I need a total count. How can I pass fullCount option into cursor and read extra.fullCount back.

1

1 Answers

2
votes

If you're running the query from the ArangoShell, then the easiest should be setting the options attribute when calling db._query() like this:

var data = { 
  query: "FOR doc IN collection FILTER doc.attr == @value LIMIT 0, 5 RETURN doc", 
  bindVars: { value: "foo" }, 
  options: { fullCount: true } 
};

var result = db._query(data);
full = result.getExtra().stats.fullCount;

The options object is optional. If it contains a fullCount subattribute, the query result will contain a fullCount subattribute in its statistics. In the above example, the result is captured in variable full.