google-cloud-firestore

Is it possible to determine the source of an incoming request?

故事扮演 提交于 2020-05-09 10:26:49
问题 Is it possible to know the hostname of the source of an incoming request to a cloud firestore document? I would like to write a database rule of the form allow write: if request.resource.data.source_host_name == some_predefined_value . This is a web application so I'm trying to find a good way to limit who gets to write to my database without using traditional auth methods. 回答1: That sort of rule is not possible with Cloud Firestore. It also wouldn't be very secure, as it's possible to spoof

Firebase Cloud Firestore create entry or update if it already exists

喜夏-厌秋 提交于 2020-05-09 06:51:06
问题 I have an issue of knowing when to add or update an entry to a Firebase Firestore database. Using doc_ref.set will add a document if it does not exist. It will also override all of a documents fields if it already exists and set is called. Using doc_ref.update will update fields of a document if the document exists. If the document does not exist, nothing happens. How do I add a new field to a document if the field does not currently exist, or update the field if it does exist? I could read

{React Native} Async\Await not working properly with setSate

喜夏-厌秋 提交于 2020-05-09 06:46:07
问题 Can someone help me understand what I am not doing correctly? Consider this simple code var images = []; const [funImage, setFunImage] = useState([]); //Some function that does this below firebase.firestore().collection('PostedFunActivities').where("location", "==" , place).get().then((querySnapshot) =>{ querySnapshot.forEach(async(doc) =>{ const ref = firebase.storage().ref('images/'+ doc.data().image) const result = await ref.getDownloadURL(); images.push(result); }) setFunImage(images); })

security rules to allow update of specific fields

て烟熏妆下的殇ゞ 提交于 2020-05-09 06:42:48
问题 I am new to security rules. I have to write security rule to prevent a user to update a document except one field. lets say i have a doc { field1 : one, field2 : two, field3 : three, . . . fieldn : n } the user logged in should be able to update only field2. using firestore security rules. 回答1: There is no explicit way in security rules to validate the update that is happening. But what you can do is validate the data in the document before and after the write operation. By comparing those

Why is Firestore rounding 64 bit integers?

拈花ヽ惹草 提交于 2020-05-09 06:22:51
问题 I'm trying to store 64 bit integers from a python program in my Firestore database. The problem is that it seems like the last digits are rounded off. doc = db.collection('questions').document('0MPvbeTEglD9lbpDq6xm') ints = [9223372036854775807, 9223372036854775533, 9223372036854775267] doc.update({ 'random': ints }) When I look in the database they are stored as: random = [9223372036854776000, 9223372036854776000, 9223372036854775000} According to the documentation 64 bit signed integers are

Do Xamarin support Firebase Cloud Firestore?

一世执手 提交于 2020-05-09 06:21:52
问题 I have a requirement to create app using xamarin and cloud firestore, but i am not able to find related documents anywhere. do really xamarin forms supports firebase cloud store, if yes please send me related link for connectivity and basic crud operation. 回答1: "Absolutely yes!" There is a very useful plugin for Xamarin Forms (Android and iOS): Plugin.CloudFirestore How to use? Create a new Firebase project: Follow the steps to put a name for your project and enable Analytics. In your

Do Xamarin support Firebase Cloud Firestore?

这一生的挚爱 提交于 2020-05-09 06:20:16
问题 I have a requirement to create app using xamarin and cloud firestore, but i am not able to find related documents anywhere. do really xamarin forms supports firebase cloud store, if yes please send me related link for connectivity and basic crud operation. 回答1: "Absolutely yes!" There is a very useful plugin for Xamarin Forms (Android and iOS): Plugin.CloudFirestore How to use? Create a new Firebase project: Follow the steps to put a name for your project and enable Analytics. In your

Type Error undefined is not an object (evaluating 'Wu.getRandomValues')

房东的猫 提交于 2020-05-09 05:16:27
问题 This is the code I implemented for adding data to collection: import FirebaseKeys from "./config"; import firebase from "firebase"; import "@firebase/firestore"; class Fire { constructor() { firebase.initializeApp(FirebaseKeys); } addPost = async ({ text, localUri }) => { const remoteUri = await this.uploadPhotoAsync(localUri); const desc = text; return new Promise((res, rej) => { // console.log("THIS FIRESTORE" + this.firestore); const dbh = firebase.firestore(); // this.firestore.collection

Firestore: Query names that match or similar to the searched term

大兔子大兔子 提交于 2020-05-08 15:58:04
问题 I have a list of users with their names in the Firestore database. What I am trying to achieve is to make users able to search and find other users. My problem is that: Query query = db.collection("users").whereEqualTo("name", searchTerm); FirestoreRecyclerOptions<UserObject> response = new FirestoreRecyclerOptions.Builder<UserObject>() .setQuery(query, UserObject.class) .build(); In the code above, I am able to find users only if I write their first and last name exactly right. But what I

How to update the document ID in firebase firestore? [duplicate]

▼魔方 西西 提交于 2020-05-08 09:18:46
问题 This question already has answers here : How to move a firestore document from cloud functions? (2 answers) Closed 2 years ago . in my firestore database, I've made the user's email as the document key. Do if I want I cal do db.collection('users').doc('email_id') to perform some action. Now the problem is when the user is updating their email id, I am not finding any way to update the document id in firestore. I've tried to do db.collection('users').doc(old_email).update({ id: new_email })