Skip to content

Instantly share code, notes, and snippets.

@IxCluzts
Created April 3, 2018 16:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IxCluzts/5226db9aef3bd605a99f3c5b94c0a816 to your computer and use it in GitHub Desktop.
Save IxCluzts/5226db9aef3bd605a99f3c5b94c0a816 to your computer and use it in GitHub Desktop.
node-red-contrib-arangodb

node-red-contrib-arangodb

This is the project build dedicately for node-red (https://nodered.org) to be easily connect with the arangodb (http://www.arangodb.com) which is open-source graph database as well.

Installation

Global Installation

npm install -g node-red-contrib-arangodb

Node List

1. Create Collection Node

This is the node use for create collection for database. This is as same as the table for the RDBMS.

2. Insert

Data payload will be inserted into the selected collection that parse into this node.

3. Query

This is the node to send AQL (Arango Query Language) to the database to query data as you want. Please refer to the document in the arangodb (http://www.arangodb.com) to learn more about how to use

4. Update

Update data for specific document in the collection. The node need the id or the revision to update the document. This is not replace.

[{"id":"c1941cf2.441ac","type":"inject","z":"e6484485.f032b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":108.5,"y":68,"wires":[["6a702d61.60e784"]]},{"id":"b1be5b0e.c444f8","type":"debug","z":"e6484485.f032b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":653.5,"y":66,"wires":[]},{"id":"6a702d61.60e784","type":"function","z":"e6484485.f032b8","name":"Settings","func":"msg.collection = \"users\"\n\nmsg.payload = {\n \"username\": \"aaaa\",\n \"password\": \"abcd\"\n}\n\nreturn msg;","outputs":1,"noerr":0,"x":268.5,"y":73,"wires":[["628a531a.c3857c"]]},{"id":"628a531a.c3857c","type":"[Arango]insert","z":"e6484485.f032b8","name":"","dbconfig":"8d57e83a.e19388","x":446.5,"y":69,"wires":[["b1be5b0e.c444f8"]]},{"id":"5c07875f.15baa8","type":"[Arango]query","z":"e6484485.f032b8","name":"","dbconfig":"8d57e83a.e19388","x":435.5,"y":119,"wires":[["df22cb65.b79808"]]},{"id":"fc36759b.302528","type":"inject","z":"e6484485.f032b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":108,"y":121,"wires":[["c44011ae.44c6c"]]},{"id":"c44011ae.44c6c","type":"function","z":"e6484485.f032b8","name":"Settings","func":"\nmsg.query = `\n FOR doc IN users\n RETURN doc\n`\n\nmsg.vars = {}\n\n\nreturn msg;","outputs":1,"noerr":0,"x":265,"y":119,"wires":[["5c07875f.15baa8"]]},{"id":"df22cb65.b79808","type":"debug","z":"e6484485.f032b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":636,"y":120,"wires":[]},{"id":"21e42044.6745d","type":"[Arango]update","z":"e6484485.f032b8","name":"","dbconfig":"8d57e83a.e19388","x":441.5,"y":171,"wires":[["947b33d2.f570a"]]},{"id":"1410404c.f2fb8","type":"function","z":"e6484485.f032b8","name":"Settings","func":"msg.collection = \"users\"\nmsg.documentHandle = 'users/23725'\n\nmsg.payload = {\n \"password\": \"AAAA\" \n}\n\n\nreturn msg;","outputs":1,"noerr":0,"x":265,"y":172,"wires":[["21e42044.6745d"]]},{"id":"947b33d2.f570a","type":"debug","z":"e6484485.f032b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":646,"y":170,"wires":[]},{"id":"73baa2d5.6c300c","type":"[Arango]createcollection","z":"e6484485.f032b8","dbconfig":"8d57e83a.e19388","name":"","x":479.5,"y":21,"wires":[["ccd77f40.36de8"]]},{"id":"667b724f.d4a4ec","type":"inject","z":"e6484485.f032b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":106,"y":26,"wires":[["dfddfe23.764d1"]]},{"id":"dfddfe23.764d1","type":"function","z":"e6484485.f032b8","name":"Settings","func":"msg.collection = \"users\"\n\nreturn msg;","outputs":1,"noerr":0,"x":263,"y":24,"wires":[["73baa2d5.6c300c"]]},{"id":"ccd77f40.36de8","type":"debug","z":"e6484485.f032b8","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":705,"y":20,"wires":[]},{"id":"9b7cd321.fe334","type":"inject","z":"e6484485.f032b8","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":172,"wires":[["1410404c.f2fb8"]]},{"id":"8d57e83a.e19388","type":"dbconfig","z":"","name":"Docker","url":"http://root:root@127.0.0.1:32789","dbname":"wow"}]
@Momentum-TN
Copy link

Hello I got this error when creating a new collection or doing any operation:
ArangoError: unknown path '/_db/myDB/_api/collection'

databaseconfig:
http://username:password@127.0.0.1:8529/_db/myDB/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment