Browse Source

prettify code

master
sovlookup 6 years ago
parent
commit
a2bafdc814
  1. 10
      packages/server/src/integrations/arangodb.js

10
packages/server/src/integrations/arangodb.js

@ -52,9 +52,7 @@ class ArangoDBIntegration {
async read(query) { async read(query) {
try { try {
const result = await this.client.query(query.sql) const result = await this.client.query(query.sql)
let rl = [] return result.all()
await result.forEach(r => rl.push(r))
return rl
} catch (err) { } catch (err) {
console.error("Error querying arangodb", err.message) console.error("Error querying arangodb", err.message)
throw err throw err
@ -67,11 +65,9 @@ class ArangoDBIntegration {
const clc = this.client.collection(this.config.collection) const clc = this.client.collection(this.config.collection)
try { try {
const result = await this.client.query( 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 = [] return result.all()
await result.forEach(r => rl.push(r))
return rl
} catch (err) { } catch (err) {
console.error("Error querying arangodb", err.message) console.error("Error querying arangodb", err.message)
throw err throw err

Loading…
Cancel
Save