google-cloud-firestore

Firestore security rules how to check if document was created by user (is owner)

白昼怎懂夜的黑 提交于 2021-01-29 05:40:38
问题 I have a firestore database with two collections: 'notes', where each document stores the content for each note and the authorId (which corresponds to the currently signed in users uid), and 'users', where the name of the user is stored and the id of each document is the uid of the user. This way, the author of the note is connected to the user in firestore. I am trying to make a web application where only the notes that the user created (authorId == uid) are shown and the other notes are not

How to get data from firebase when page loading using vuejs?

 ̄綄美尐妖づ 提交于 2021-01-29 05:38:28
问题 I have been trying to get current user data from firebase to display details in profile page. Here i am trying get data from firestore, when page loading. My table structure : users => Current user UID => email, firstname, lastname, businessname, etc. I have added functionality to get data from firebase when profile page loading but does not work. error showing in console product.data().firstname is not function. And also i did not get any console output firebase data retrieved or not? here

What is the best way to implement simple text search

不问归期 提交于 2021-01-29 05:30:51
问题 Currently, I have a firestore database set up with a users collection and a funkoPops collection. The funkoPops collections has about 750 documents which are genres/series of funko pops. So an example of one document would be, document.id = "2014 Funko Pop Marvel Thor Series 2 Vinyl Figures" and that document has fields of funkoData, and genre. funkoData is an array of objects that are the funko pops that are within that 2014 series as you can see here. What is the best way to query for say

Firestore text search containing keyword Flutter

我只是一个虾纸丫 提交于 2021-01-29 05:24:55
问题 i was planning to have a full text search feature for the String name field of my document, but from the research i have done , it seems like searching text with firestore is not possible, then i come up with solution which is creating a new array field to store keyword in document, like this and then i called it using arracVontains, with searchedKeyword as the inputted text from user _firestore .collection(itemOrderPath) .where("keyword", arrayContains:searchedKeyword) Now, i'm quite

Get document id when searching with where clause firestore

删除回忆录丶 提交于 2021-01-29 05:18:11
问题 I want to be able to get the document id of a document that I have just queried with a where clause in firestore. Here is an example that I have at the moment: db.collection("Users").where('fullname', '==', 'foo bar').limit(5).get() .then(function (doc) { querySnapshot.forEach(function (doc) { //find document id } } From this, I want to be able to get the document id of what I have just queried. Is there any way I can do that? Thanks in advance. 回答1: an example solution to what you're looking

Firebase security rules cross project

感情迁移 提交于 2021-01-29 04:04:14
问题 Project A has Firebase Authentication and Project B has Firebase Firestore. Both Authentication and Firestore are working correctly using: https://firebase.google.com/docs/projects/multiprojects (Web) However when writing the following Project B Firestore Security Rules: rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /users/{uid} { allow get: if request.auth.uid == uid; } } } I get an error: Missing or insufficient permissions Because the

Firestore Timestamp.fromDate not UTC

断了今生、忘了曾经 提交于 2021-01-29 04:02:03
问题 Anyone knows how to persist UTC Timestamp in Firestore? In my Angular app, if I convert today's date to a Timestamp like the following and I end up with a UTC+2 (it's summer time here right now in Switzerland) date in the Firestore database import {firebase} from '@firebase/app'; import '@firebase/firestore'; const myTimestamp = firebase.firestore.Timestamp.fromDate(new Date()); If for example I try to convert a date from the winter time, I end up with UTC+1 Timestamp in the database const

how can I make custom auto generated IDs for documents in firestore

懵懂的女人 提交于 2021-01-29 04:01:14
问题 For my project I need ids that can be easily shared, so firestores default auto generated ids won't work. I am looking for a way to auto generate id like 8329423 that would be incremented or randomly chosen in range 0 to 9999999. 回答1: Firestore's auto-ID fields are designed to statistically guarantee that no two clients will ever generate the same value. This is why they're as long as they are: it's to ensure there is enough randomness (entropy) in them. This allows Firestore to determine

undefined is not an object (evaluating ' _firebase.firebase.firestore

情到浓时终转凉″ 提交于 2021-01-29 02:40:57
问题 i want to fetch all data from firestore and show on a list export const fetchAds = () => { return dispatch => { firebase .firestore() .collection("ads") .get() .then(ads => { dispatch({ type: FETCH_ADS, ads }); }); }; }; this is my actions file import * as actions from "../../actions"; class HomeScreen extends Component { renderAds() { return this.props.ads.map((ad, index) => { return <Cards key={index} ad={ad} />; }); } function mapStateToProps(state) { return { ads: state.ads.data }; }

FirebaseError: [code=resource-exhausted]: Resource has been exhausted (e.g. check quota)

断了今生、忘了曾经 提交于 2021-01-29 02:18:31
问题 I have an array of size 10000. All those are document ids. I am running an array and need to get the document data from Firestone and need to add the new fields in each document. But I am facing the below errors like @firebase/firestore: Firestore (5.3.1): FirebaseError: [code=resource-exhausted]: Resource has been exhausted (e.g. check quota). @firebase/firestore: Firestore (5.3.1): Using maximum backoff delay to prevent overloading the backend. Error getting document: FirebaseError: Failed