google-cloud-firestore

How to initialize default values for GeoPoint in a data class

坚强是说给别人听的谎言 提交于 2021-02-05 12:13:10
问题 I'm trying to convert documents to objects from Firestore, but when I create my data class , I dont know how to initialize the GeoPoint with default values as it needs to be declared for an empty constructor data class MapObj(val geopoint:Geopoint) //--> how to initialize it to get an empty constructor The problem relies on this line val obj = snapshot.toObject(MapObj::class.java) Thanks 回答1: The problem is that the Firestore SDK isn't finding a default, no argument constructor for MapObj.

How to initialize default values for GeoPoint in a data class

徘徊边缘 提交于 2021-02-05 12:11:24
问题 I'm trying to convert documents to objects from Firestore, but when I create my data class , I dont know how to initialize the GeoPoint with default values as it needs to be declared for an empty constructor data class MapObj(val geopoint:Geopoint) //--> how to initialize it to get an empty constructor The problem relies on this line val obj = snapshot.toObject(MapObj::class.java) Thanks 回答1: The problem is that the Firestore SDK isn't finding a default, no argument constructor for MapObj.

How to initialize default values for GeoPoint in a data class

故事扮演 提交于 2021-02-05 12:10:48
问题 I'm trying to convert documents to objects from Firestore, but when I create my data class , I dont know how to initialize the GeoPoint with default values as it needs to be declared for an empty constructor data class MapObj(val geopoint:Geopoint) //--> how to initialize it to get an empty constructor The problem relies on this line val obj = snapshot.toObject(MapObj::class.java) Thanks 回答1: The problem is that the Firestore SDK isn't finding a default, no argument constructor for MapObj.

How to query a list of Objects with Firebase in Flutter

泪湿孤枕 提交于 2021-02-05 11:45:28
问题 I want to be able to query my collections for document Ids, and then get a list of documents. For Example: Collection [Users] -> Documents [001], [002], [003]. Now I want to query in Users for the ids 001 and 003. Is there an easy way to do this in flutter, or is the recommended way to just just query for 001 and 003 individually ? 回答1: You can use an in query for anywhere up to 10 documents. collectionRef.where("country", whereIn: ["USA", "Japan"]) If you have more than 10, you can either

Calling a firebase cloud function from nodejs

余生长醉 提交于 2021-02-05 11:44:26
问题 I want to call a cloud function from firebase from another nodejs server or just a nodejs script. My firebase function is an onCall function. I am using https://www.npmjs.com/package/firebase-admin for interacting with firebase but it doesn't seem to have a way of calling cloud functions... Can I do it any other way? Like a http request? 回答1: In short: You have to trigger http event. Currently, firebase does support two invoke options. If you read through documentation here and here, there is

Firebase Firestore - security rule based on “where” query parameters

痴心易碎 提交于 2021-02-05 11:31:40
问题 I'm trying to secure requests to a collection to allow any single get , but to allow list only if a specific key is matched. Database structure is like this: posts post1 content: "Post 1 content" uid: "uid1" post2 content: "Post 2 content" uid: "uid1" post3 content: "Post 3 content" uid: "uid2" The Firestore query I'm making from Vue: // Only return posts matching the requested uid db .collection("posts") .where("uid", "==", this.uid) The security rules I'd like to have would be something

How to do advance filter and sort ( E-commerce ) using Firestore

牧云@^-^@ 提交于 2021-02-05 11:26:13
问题 I am trying to build an E-commerce app using firebase firestore, i am stuck at filtering and and sorting the product on user input. I am able to apply all filter and sort but I want to do the filter on user input and i cannot leave the where clause empty so i want to generate a fire base query on user input without so if or leave the where clause empty so it doesn't effect the query how can i generate the query dynamically .collection('allProducts') .where('published', '==', true) .where(

How to assign field value of a collection document to another collection document field as a value in Firestore using java? [closed]

為{幸葍}努か 提交于 2021-02-05 11:24:27
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 9 months ago . Improve this question I have 2 collections; BookingInformation and ParkingArea. From the ParkingArea document, I want to save the latest value of the "areanumber" field to the BookingInformation collection with the field name "Area". I have tried the following. In logcat, I can view the required

Array of JSON object is not empty but cannot iterate with foreach, show zero length [duplicate]

怎甘沉沦 提交于 2021-02-05 11:21:10
问题 This question already has an answer here : How to get data from firestore DB in outside of onSnapshot (1 answer) Closed 1 year ago . I read a collection about book checkout from firestore in create() . The data is store in checkout array that declared in data() . export default { name: "checkout-history", data() { return { checkout: [] ] }; }, created() { db.collection("checkout") .get() .then(querySnapshot => { querySnapshot.forEach(doc => { const data = { id: doc.id, // firebase document id

Firestore pagination - how to find if there are more data after query (using limit)

前提是你 提交于 2021-02-05 10:48:05
问题 We use ndb datastore in our current python 2.7 standard environment. We migrating this application to python 3.7 standard environment with firestore (native mode). We use pagination on ndb datastore and construct our query using fetch. query_results , next_curs, more_flag = query_structure.fetch_page(10) The next_curs and more_flag are very useful to indicate if there is more data to be fetched after the current query (to fetch 10 elements). We use this to flag the front end for "Next Page" /