So i want to set my documents on firebase in a way such that a submitted email becomes the document ID With v8 of Firebase i can do
db.collectiion('dbName')
.doc({authorizedUserEmail})
.set({
'myProperty: dataType'
})
But with v9 i cannot figure it out even while using the doc https://firebase.google.com/docs/firestore/query-data/get-data
Also i'm writing React-native
CodePudding user response:
As explained in the doc, you can do as follows:
import { doc, setDoc } from "firebase/firestore";
await setDoc(doc(db, "dbName", {authorizedUserEmail}), {
'myProperty: dataType'
});
Note that "collection" takes only one "i" (your code contains db.collectiion('dbName')
).