google-cloud-firestore

Firestore arrayUnion

谁都会走 提交于 2020-08-24 07:05:09
问题 I'm building a basic CRUD app with vue.js and firebase. I'm trying to build out a favorites functionality and have ran into a persistent problem storing the data. When a using clicks the add to favorites button I'm attempting to add the document id to an array in a "user profile" document. Here's the code: export function addNewUserAction (type, key, userID){ console.log(userID); console.log(key); firebase.firestore().collection('userActions').add({ type: type, listing: key, user: userID,

Firestore NoSql Database Structure (as a n-ary tree)

回眸只為那壹抹淺笑 提交于 2020-08-24 02:35:57
问题 I am developing an app that will offer the possibility to filter the users you search (gender, age, location, ...). I want to make this fast and as cheaper as possible, so I have decided to store my data as a n-ary tree, just something like this: ----- Users ----- Root Node: Gender (male or female) -male --country (nodes: USA, UK, Spain, Germany, France, Italy, ...) ---age (nodes: 18, 19, 20, 21, 22, ..., 60) ->user (leaf nodes) -female --country (nodes: USA, UK, Spain, Germany, France, Italy

Firestore NoSql Database Structure (as a n-ary tree)

五迷三道 提交于 2020-08-24 02:29:49
问题 I am developing an app that will offer the possibility to filter the users you search (gender, age, location, ...). I want to make this fast and as cheaper as possible, so I have decided to store my data as a n-ary tree, just something like this: ----- Users ----- Root Node: Gender (male or female) -male --country (nodes: USA, UK, Spain, Germany, France, Italy, ...) ---age (nodes: 18, 19, 20, 21, 22, ..., 60) ->user (leaf nodes) -female --country (nodes: USA, UK, Spain, Germany, France, Italy

Firestore - Sanitizing Text Area Input?

寵の児 提交于 2020-08-23 03:53:17
问题 I see in the Writing conditions for Cloud Firestore Security Rules documentation that a (server side) custom function can be run against new writes. My question is: do I even need to worry about sanitizing textarea user input before writing/saving that to FireStore, or does Firestore automatically do this? If I need to sanitize user input, what would a javascript function look like to do that? What characters should I disallow or remove from the string? Thanks in advance. 回答1: Firestore does

How to increment existing number field in Cloud Firestore

怎甘沉沦 提交于 2020-08-22 07:42:19
问题 I have a field which indicates the number of transactions. I would like to increment it by 1 as soon as a transaction occurs. I could'nt find any method to directly execute this. One method is to get the user first and then update the field with the received value + 1 , but this is too lengthy and slow. Can anyone tell me any other feasible method? 回答1: Firestore now has a specific operator for this called FieldValue.increment() . By applying this operator to a field, the value of that field

correct way to use firestore onSnapShot with react redux

烈酒焚心 提交于 2020-08-21 07:02:08
问题 I'm trying to figure out the correct way to use firestore.onSnapshot with react-redux. I currently have this code in my action file, which I am calling on componentWillMount() in my component. export const fetchCheckins = () => async (dispatch) => { const {currentUser} = firebaseService.auth(); try { let timestamp = (new Date()); //set timestamp for beginning of today timestamp.setHours(0); //get checkins today let checkinstoday = (await firebaseService.firestore().collection(`/checkins/$

correct way to use firestore onSnapShot with react redux

╄→尐↘猪︶ㄣ 提交于 2020-08-21 07:01:46
问题 I'm trying to figure out the correct way to use firestore.onSnapshot with react-redux. I currently have this code in my action file, which I am calling on componentWillMount() in my component. export const fetchCheckins = () => async (dispatch) => { const {currentUser} = firebaseService.auth(); try { let timestamp = (new Date()); //set timestamp for beginning of today timestamp.setHours(0); //get checkins today let checkinstoday = (await firebaseService.firestore().collection(`/checkins/$

Pagination with Firebase firestore - swift 4

爷,独闯天下 提交于 2020-08-21 04:54:32
问题 I'm trying to paginate data (infinitely scroll my tableview) using firestore. I've integrated the code google gives for pagination as best I can, but I'm still having problems getting the data to load in correctly. The initial set of data loads into the tableview as wanted. Then, when the user hits the bottom of the screen, the next "x" amount of items are load in. But when the user hits the bottom of the screen the second time, the same "x" items are simply appended to the table view. The

Flutter - How do I use await inside the streambuilder?

一世执手 提交于 2020-08-20 11:32:21
问题 I want to use await inside streambuilder. However, if you use async inside, you get an error. On the code below !!!!!!!! That's the part I want to solve. Thank you very much if I can tell you how. class _MemoStreamState extends State<MemoStream> { final _fireStore = Firestore.instance; @override Widget build(BuildContext context) { return StreamBuilder<QuerySnapshot>( stream: _fireStore .collection(widget.logInUsrEmail) .orderBy('id', descending: false) .snapshots(), builder: (context,

Getting the respsonse: "INVALID_ARGUMENT: Project id 'X' , is malformed

久未见 提交于 2020-08-20 11:31:34
问题 I'm trying to connect to google firestore and for some reason my process.env.FIREBASE_PROJECT_ID keeps spitting out the error: @firebase/firestore: Firestore (7.17.1): Connection GRPC stream error. Code: 3 Message: 3 INVALID_ARGUMENT: Project id 'name-of-project', is malformed: it either contains invalid characters or is too long. Look at https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects for instructions in how to get a project's id. [2020-08-04T23