看到我使用以下代码添加数据
db.collection("users").add({
email: $('#emailaddress-register').val(),
password: $('#password-register').val()
}).then((done) => {
alert('Account created sucessfully'+done);
}).catch(function (error) {
console.error('Error adding document: ', error)
});
答案 0 :(得分:1)
好吧,根据您提供的信息:
var config = {
apiKey: "",
authDomain: "",
databaseURL: "",
projectId: "",
storageBucket: "",
messagingSenderId: ""
};
firebase.initializeApp(config);
const firestore = firebase.firestore();
const settings = {timestampsInSnapshots: true};
firestore.settings(settings);
let db = firebase.firestore();
它仅需要一个Firestore实例:
var config = {
apiKey: "",
authDomain: "",
databaseURL: "",
projectId: "",
storageBucket: "",
messagingSenderId: ""
};
firebase.initializeApp(config);
const db = firebase.firestore();
const settings = {timestampsInSnapshots: true};
db.settings(settings);
然后,您可以使用所获得的东西。