Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions firestore.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@
<input type="text" id="node-input-projectId">
</div>

<!--Database ID-->
<div class="form-row">
<label for="node-input-databaseId"><i class="fa fa-cloud"></i> Database</label>
<input type="text" id="node-input-databaseId">
</div>

<!--Operation-->
<div class="form-row">
<label for="node-input-mode"><i class="fa fa-gear"></i> Operation</label>
Expand Down Expand Up @@ -94,7 +100,7 @@ <h3>Details</h3>
</p>

<p>
The configuration parameters of the node include the Project Id to be used for billing.
The configuration parameters of the node include the Project Id to be used for billing. If database is omitted, the default database will be used.
</p>

<p>
Expand All @@ -113,8 +119,9 @@ <h3>Details</h3>
defaults: {
account: { type: "google-cloud-credentials", required: false },
keyFilename: { value: "", required: false },
name: { value: "", required: false },
projectId: { value: "", required: true},
name: { value: "", required: false },
databaseId: { value: "", required: false},
mode: { value: "set", required: false}
},
inputs: 1,
Expand Down
8 changes: 6 additions & 2 deletions firestore.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module.exports = function(RED) {
const node = this;
const staticQuery = config.query;
const projectId = config.projectId;
const databaseId = config.databaseId;

let credentials = null;
if (config.account) {
Expand Down Expand Up @@ -156,16 +157,19 @@ module.exports = function(RED) {
if (credentials) {
firestore = new Firestore({
"projectId": projectId,
"databaseId": databaseId,
"credentials": credentials
});
} else if (keyFilename) {
firestore = new Firestore({
"projectId": projectId,
"databaseId": databaseId,
"keyFilename": keyFilename
});
} else {
firestore = new Firestore({
"projectId": projectId
"projectId": projectId,
"databaseId": databaseId
});
}

Expand All @@ -174,4 +178,4 @@ module.exports = function(RED) {


RED.nodes.registerType(NODE_TYPE, FireStoreNode);
};
};