LIMIT clause is used to limit number of documents.
Example
queryToExecute = `FOR doc IN users LIMIT 2 RETURN doc`
127.0.0.1:8529@abc_org> db._query(queryToExecute) [object ArangoQueryCursor, count: 2, cached: false, hasMore: false] [ { "_key" : "41688", "_id" : "users/41688", "_rev" : "_cSA6tje--A", "id" : 3, "firstName" : "Madhu", "lastName" : "Thatha" }, { "_key" : "41308", "_id" : "users/41308", "_rev" : "_cSBTpJC---", "country" : "India", "firstName" : "Gopi" } ]
Example 2
queryToExecute = `FOR doc IN users FILTER doc.age > 32 LIMIT 3 RETURN doc`
127.0.0.1:8529@abc_org> queryToExecute = `FOR doc IN users ...> FILTER doc.age > 32 ...> LIMIT 2 ...> RETURN doc` FOR doc IN users FILTER doc.age > 32 LIMIT 2 RETURN doc 127.0.0.1:8529@abc_org> db._query(queryToExecute) [object ArangoQueryCursor, count: 2, cached: false, hasMore: false] [ { "_key" : "43460", "_id" : "users/43460", "_rev" : "_cSBlsQe---", "firstName" : "Ram", "lastName" : "Gurram", "age" : 35 }, { "_key" : "43468", "_id" : "users/43468", "_rev" : "_cSBl3BW---", "firstName" : "Siva", "lastName" : "Ponnam", "age" : 35 } ]
Previous Next Home
No comments:
Post a Comment