Add custom nodes in firebase using Node-RED - node.js

I am new to Raspberry Pi and Node-RED. I am want to add custom node to firebase using Node-RED nodes. Here is my database screenshot :
I have used push option of firebase node to create multiple nodes with auto generated ID's. I want to give custom ID like "User1", "User2" and so on using firebase node in Node-RED. How can this be achieved.

push() always generates random IDs. The names of these nodes can't be changed after they're added. If you want to assign your own names, you will need to build a path to the node you want, and populate it with set().

Related

how to get my front-end updated when I add to my database?

I'm designing a real-estate website and I was wondering can I link my front-end webpage that shows the available properties for sale that a new property icon is added when I add to my MongoDB ? to elaborate more, I have a template for each single property which includes picture and some other info about the property, what i want to do is when i add a new collection to my database to appear on my webpage with this template. Thanks in advance
MongoDB can be watched, since your question has 'node.js' tag so assume you use node.js in the server side, I check the doc and there's a watch API returning a ChangeStream object which you may use, just for your reference
If you want to use angular for retrieving and showing data.
You can refer to these sites :
This one tells how to populate data in angular.
&
To get a crisp of doing it with mongo db
What you actually need is server side event system updating your frontend, Changestream that #user1108069 mentioned can be useful in detecting new changes or you can literally identify that when a request is being made to add a new property.
The task here is to update the frontend's current connections to update their view to get the new (load) changes, you can do this in multiple ways.
Use something like firebase realtime DB on the side Firebase Realtime DB
Use any other server side events broker for you This should work too
You can create your own full duplex system, using something like socket.io but do remember that concurrent connections needs to be handled properly. You cannot keep them connected to your server all the time.
Cheers!

Add new node to existed CouchDB cluster after cluster_finished

Can I add new node to an existed CouchDB cluster?
Basically, I already completed a CouchDB cluster configuration using /_cluster_setup API, with finish_cluster action. Can I still add another new node to the cluster manually using CouchDB REST API? I tried to use /_cluster_setup API again to add it, but the new node is not included in "all_nodes" section from /_memebership API.
I also tried to follow the example on http://docs.couchdb.org/en/stable/cluster/nodes.html#adding-a-node . But it seems not helping.
Any recommendation?

How to use users custom name in Twilio Programmable video with node js

My script is working perfect, i am using this sample : https://github.com/TwilioDevEd/sdk-starter-node
i tried everything to connect users with custom name, but i cant do it. i am new in node js
you can see code at github
https://github.com/TwilioDevEd/sdk-starter-node/blob/master/public/video/quickstart.js
it is auto generating names. but i want to use my user's names.
can you help me?

Neo4j seraph-model: Create a node with relation to other node

Hi i have started working the neo4j and the seraph and seraph-model packages.
A problem poped:
I cannot seem to find an way to create a Node connected to other node in one query example:
Create (n:User)-[r:Has]->(p:UserImage)
I know I can do that using a the native seraph.query but then I lose some of the model features.. (like the timestamps)
Is there some otherway to do that?
How expensive is to do that query in 3 steps? (create user, create image, link then)
seraph-model is extension of seraph. seraph.query is for raw query. model features are accessible only when use modelName.Method

Getting the next node id for a Neo4j Node using the REST API

EDIT
When i am talking about node and node id i am specifically talking about the Neo4j representation of a node not node as in Node.js
I am building out an application on top of Neo with node using the thingdom wrapper on top of the REST API and i am attempting to add my own custom id property that will be a hash of the id to be used in the URL for example.
What i am currently doing is creating the node and then once the id is returned hashing this and saving it back to the node, so in effect i am calling the REST API twice to create a single node.
This is a long shot but is there a way to get a reliable next id from Neo using the REST API so that i can do this all in one request.
If not does anyone know of a better approach to what i am doing?
The internal id of neo4j nodes is not supposed to be used for external interfaces, as noted in the documentation. That means especially it's not a good idea to try to guess the next id.
It's recommended to use application specific ids to reference nodes, if you use UUIDs (especially uuid type 4) there is only a minimal chance of collisions and you can compute them on node creation, before storing them in the database.
By curiosity, can I ask you why you need to have the Id stored in the Node?
But anyway, it's quite common in Node.js to call a succession of APIs. And you will see that with Neo4j it will be required more than once.
If you don't already use it, I can only suggest you to take a look at Async: https://github.com/caolan/async
And particularly to the "waterfall" method that allows you to call more than one API that use the result of the previous call.

Resources