google-cloud-firestore

Firebase Firestore Query Between Two Timestamps

你。 提交于 2020-04-07 10:31:06
问题 I want to find events that are a on now and upcoming (next 30 days) but that are also not in the past. When i run this as a cloud function, I get "Cannot have inequality filters on multiple properties". How am I meant to get this type of data. (ignore the fact that the date stuff is a bit messy, am still playing around). // Create date 30 days in future const searchData: Date = new Date(); searchData.setDate(searchData.getDate() + 30); // Load data and handle empty respoonse const response:

Firebase Firestore Query Between Two Timestamps

不羁岁月 提交于 2020-04-07 10:28:48
问题 I want to find events that are a on now and upcoming (next 30 days) but that are also not in the past. When i run this as a cloud function, I get "Cannot have inequality filters on multiple properties". How am I meant to get this type of data. (ignore the fact that the date stuff is a bit messy, am still playing around). // Create date 30 days in future const searchData: Date = new Date(); searchData.setDate(searchData.getDate() + 30); // Load data and handle empty respoonse const response:

How do I update data inside documents without specifying the document ID?

拈花ヽ惹草 提交于 2020-04-07 08:07:12
问题 Is there a way to update data inside documents without specifying the document ID, But while going thorugh stackoverflow I saw this code firebase.firestore().collection("users") .where("name", "==", "Daniel") .get(function(querySnapshot) { querySnapshot.forEach(function(document) { document.ref.update({ ... }); }); }); Can someone please translate this to flutter code(Dart) please. It's a query to norrow down the document search without having to put in the document ID. I think. 回答1: The Dart

Is it possible to run aggregation queries in Firestore?

杀马特。学长 韩版系。学妹 提交于 2020-04-07 06:29:06
问题 Stack: Ionic Nodejs/Express Cloud Firestore I am tasked with writing an app that takes dates in "day" format, with a balance for that day, and displaying that data in a chart using Chart.js. There are interval buttons that allow you to change between "day", "week", and "month" that is supposed to group the dates into respective intervals. This currently works fine using 1 collection. "days" and "weeks" both work, but once we get to "month" with large amounts of data Firestore kills itself in

Is it possible to run aggregation queries in Firestore?

女生的网名这么多〃 提交于 2020-04-07 06:28:09
问题 Stack: Ionic Nodejs/Express Cloud Firestore I am tasked with writing an app that takes dates in "day" format, with a balance for that day, and displaying that data in a chart using Chart.js. There are interval buttons that allow you to change between "day", "week", and "month" that is supposed to group the dates into respective intervals. This currently works fine using 1 collection. "days" and "weeks" both work, but once we get to "month" with large amounts of data Firestore kills itself in

Firebase listener with React Hooks

大城市里の小女人 提交于 2020-03-31 06:05:53
问题 I am trying to figure out how to use a Firebase listener so that cloud firestore data is refreshed with react hooks updates. Initially, I made this using a class component with a componentDidMount function to get the firestore data. this.props.firebase.db .collection('users') // .doc(this.props.firebase.db.collection('users').doc(this.props.firebase.authUser.uid)) .doc(this.props.firebase.db.collection('users').doc(this.props.authUser.uid)) .get() .then(doc => { this.setState({ name: doc.data

Firebase listener with React Hooks

余生长醉 提交于 2020-03-31 06:05:07
问题 I am trying to figure out how to use a Firebase listener so that cloud firestore data is refreshed with react hooks updates. Initially, I made this using a class component with a componentDidMount function to get the firestore data. this.props.firebase.db .collection('users') // .doc(this.props.firebase.db.collection('users').doc(this.props.firebase.authUser.uid)) .doc(this.props.firebase.db.collection('users').doc(this.props.authUser.uid)) .get() .then(doc => { this.setState({ name: doc.data

Unreliable Google Firebase transactions

亡梦爱人 提交于 2020-03-25 18:21:29
问题 In my (greatly simplified) model I have users, accounts and account_types. Each user can have multiple accounts of each account_type. When an account of type TT is created I'm updating the "users" field of that object so it keeps the users which have accounts of that types, and the number of such accounts they have. users: { some fields }, accounts: { userID: UU, type: TT }, account_type: users: { UU: 31 } } I use the onCreate and onDelete cloud triggers for accounts to update the account

Unreliable Google Firebase transactions

亡梦爱人 提交于 2020-03-25 18:21:17
问题 In my (greatly simplified) model I have users, accounts and account_types. Each user can have multiple accounts of each account_type. When an account of type TT is created I'm updating the "users" field of that object so it keeps the users which have accounts of that types, and the number of such accounts they have. users: { some fields }, accounts: { userID: UU, type: TT }, account_type: users: { UU: 31 } } I use the onCreate and onDelete cloud triggers for accounts to update the account

How do i get the records which are offline - Firestore

南楼画角 提交于 2020-03-25 18:18:11
问题 I want to go offline and add 1 entry in cities collection using this code below:: firebase.firestore().collection("cities").doc("NY").set({ name: "Los Angeles", state: "CA", country: "USA" capital: false }) .then(function() { console.log("Document successfully written!"); }) .catch(function(error) { console.error("Error writing document: ", error); }); How do i add the above code inside firebase.firestore().disableNetwork().then(function() { and .onSnapshot({includeMetadataChanges: true},