Firestore: create document with an autogenerated id
Opened this issue · 1 comments
Albert-Alvarez commented
How can I create a document inside a (sub)collection without indicate an id to allow Firestore to create an autogenerated one?
Thx in advance.
camow7 commented
You can control this yourself. For example I use a function node to create the object ID based on timestamps.
var d = new Date();
let newMsg = {
payload: {
content: {
distance: msg.payload
},
path: `collection_name/${d.getTime()}`
}
}
return newMsg;
You could just change the timestamp to a random GUID you generate.