after not finding anything online, I decided to write here. I need to get all the document in the /user/uid collection in Node JS. When I use the Firebase code it replies like this:
Promise {<pending>}
Please help me!
PS: I don't want to use Firebase Admin SDK and await.
"Full" code
var express = require('express');
const { initializeApp } = require("firebase/app");
const { getDatabase, ref, get, child, set, onValue} = require("firebase/database");
const { getFirestore, collection, getDoc, doc} = require("firebase/firestore");
const firebaseApp = initializeApp(firebaseConfig);
// Get a reference to the database service
var app = express();
const PORT = process.env.PORT || 5050
app.get('/', (req, res) => {
res.send('This is my demo project')
});
const db = getDatabase();
const firestore = getFirestore();
const document = getDoc(doc(collection(firestore, 'users'), "BW5kylV6rtZXtYibpKGc2m1asRm1"));
console.log(document);
//Response: "Promise {<pending>}""