前提
node.js express firestoreを使って自己紹介アプリを作成しています。
実現したいこと
userIdとpasswordをfirestoreから取ってきて、ユーザーから受け取ったものと一致しているか確認し、okならtrue、間違っていたらfalseを返す関数を作っているところで、返り値がPromise<pending>になっておりこれをtureかfalseと表示させたいです。
該当のソースコード
非同期処理のpromiseをどのように扱えばいいか
model.js
1exports.isRightOrNot = async function isRightOrNot(userId, password) { 2 const userRef = db.collection("xxx").doc("xxx"); 3 const doc = await userRef.get(); 4 if(doc.exists && doc.data().password === password) { 5 console.log("ok"); 6 return true; 7 } else { 8 return false; 9 } 10}
main.js
1const re = isRightOrNot("XXX","xxx"); 2console.log(re); 3 4$ Promise { <pending> }
このreにtrueかfalseを入れたい
試したこと
then()~~だったりで、調べてやっているのですが、うまくいかない状態が続いています。
アドバイス頂けたら嬉しいです。

バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/04/28 06:57
2022/04/28 07:01
2022/04/28 07:03
2022/04/28 07:17
2022/04/28 07:22
2022/04/28 07:59
2022/04/28 08:25