我在 express 中创建了一个查询来提取我的数据,这是我的端点 express 函数:
app.get('/locatii', (req, res) => {
const geofirestore = new GeoFirestore(db);
const geocollection = geofirestore.collection('locatii2');
const query = geocollection.near({
center: new firebase.firestore.GeoPoint(45.831922, 27.431149),
radius: 3000
});
query.get().then(snap => {
console.log(snap.docs())
let places = [];
snap.forEach(doc => {
places.push(doc.data());
console.log(doc.data())
});
res.json(places);
})
.catch(err => res.send(err));
});