2 回答

TA貢獻(xiàn)1863條經(jīng)驗(yàn) 獲得超2個(gè)贊
嘗試這個(gè):
const db = admin.firestore();
app.post('/api/createrdv', (req, res) => {
(async () => {
try {
await db.collection('rvlist').doc() // CREATION AUTO DE L'ID // POUR CREER AVEC ID PERSO ('/' + req.body.id + '/')
.create({
//id: req.body.id,
latlong: new GeoPoint(Number(req.body.lat),
Number(req.body.lng)),
name: req.body.name,
phone: req.body.phone,
psnumber: req.body.psnumber,
rvtime: req.body.rvtime,
vu: req.body.vu
});
return res.status(200).send();
} catch (error) {
console.log(error);
return res.status(500).send(error);
}
})();
});

TA貢獻(xiàn)1859條經(jīng)驗(yàn) 獲得超6個(gè)贊
app.post('/api/create', (req, res) => {
(async () => {
? ? try {
? ? ? ? await db.collection('psdata').doc() // CREATION DE L'ID AUTOMATIQUE // POUR CREER AVEC ID PERSO ('/' + req.body.id + '/') //
? ? ? ? ? ? .create({
? ? ? ? ? ? ? //id: req.body.id,
? ? ? ? ? ? ? ? latlong: new admin.firestore.GeoPoint(Number(req.body.lat),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Number(req.body.lng)),
? ? ? ? ? ? ? ? city: req.body.city,
? ? ? ? ? ? ? ? name: req.body.name,
? ? ? ? ? ? ? ? phone: req.body.phone,
? ? ? ? ? ? ? ? psnumber: req.body.psnumber,
? ? ? ? ? ? ? ? speciality: req.body.speciality,
? ? ? ? ? ? ? ? streetadress: req.body.streetadress,
? ? ? ? ? ? ? ? zipcode: req.body.zipcode,
? ? ? ? ? ? ? ??
? ? ? ? ? ? });
? ? ? ? return res.status(200).send();
添加回答
舉報(bào)