From 31925ce3c030712630883bb7eb1c8574f67297fe Mon Sep 17 00:00:00 2001 From: sovlookup <805408477@qq.com> Date: Thu, 28 Jan 2021 23:08:53 +0800 Subject: [PATCH] prettify code --- packages/server/src/integrations/arangodb.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/server/src/integrations/arangodb.js b/packages/server/src/integrations/arangodb.js index 2b3ee1b11b..10449fc967 100644 --- a/packages/server/src/integrations/arangodb.js +++ b/packages/server/src/integrations/arangodb.js @@ -52,9 +52,7 @@ class ArangoDBIntegration { async read(query) { try { const result = await this.client.query(query.sql) - let rl = [] - await result.forEach(r => rl.push(r)) - return rl + return result.all() } catch (err) { console.error("Error querying arangodb", err.message) throw err @@ -67,11 +65,9 @@ class ArangoDBIntegration { const clc = this.client.collection(this.config.collection) try { const result = await this.client.query( - aql`INSERT ${query.json} INTO ${clc} LET n = NEW RETURN NEW` + aql`INSERT ${query.json} INTO ${clc} RETURN NEW` ) - let rl = [] - await result.forEach(r => rl.push(r)) - return rl + return result.all() } catch (err) { console.error("Error querying arangodb", err.message) throw err