This question already has answers here:
How to move a firestore document from cloud functions?
(2 answers)
Closed 2 years ago.
i'm looking for a way to change the document Id of a existing document. Is there a solution or do I need do copy all data and create a new document with the new document id?
Thanks a lot!
There isn't any way to change the id of an existing Firestore document.
You will therefore need to "copy all data and create a new document with the new document id".
Related
This question already has answers here:
How can i rename a branch/node in firebase
(3 answers)
How to update the node key in Firebase?
(1 answer)
How to copy a record from a location to another in Firebase realtime database?
(1 answer)
Closed 1 year ago.
I want to update root name of an item in firebase real time database.
How to do that?
reference.child(Name).setValue(updateItem);
This code create a new item with a new name.
This question already has answers here:
Check if value in Firebase Realtime Database is equal to String [duplicate]
(2 answers)
Closed 2 years ago.
I'm working on a Doctor-on-Demand kind of application and I want to use firebase for the project. I have 3 types of users and Apps:
Patients
Doctors
Admin
What are workaround on this, for example for the case of authentication each have their own custom fields.
Its not clear why you want to use firebase and for what purpose. I mean how you want to use firebase here. Please give some more detail about it.
Set the value like is_admin == 1 and is_doctors == 2 and is_patients == 3 and please give some more detail about it.
This question already has an answer here:
Unexpected Behavior When Query by .whereArrayContains()
(1 answer)
Closed 4 years ago.
To get the data from the firestore collection for instance update I tried the below query.
docRef.whereArrayContains().orderBy().limit()
com.google.firebase.firestore.FirebaseFirestoreException: FAILED_PRECONDITION: The query requires an index. You can create it here:
If you attempt a compound query with a range clause that doesn't map to an existing index, you receive an error. The error message includes a direct link to create the missing index in the Firebase console.
Manage indexes in Cloud Firestore
When you get the error check LogCat for the link
This question already has answers here:
Google Firestore - How to get several documents by multiple ids in one round-trip?
(17 answers)
Closed 4 years ago.
I have below FireStore data
And I have a list specialUsers which is defined as
val specialUsers = arrayOf("stark#gmail.com", "lannester#gmail.com")
So I want to get collections which are in the specialUsers, something like
collection("users").whereIn(specialUsers)
But, couldn't find any documentation related to this. How can I perform above intention in Firestore?
As he says here in 6:19
There is still no way for the database to automatically grab specific user name and profile for each review as I requesting them. I would need to make separate database request for every single review I get to fetch this information and that's bad. so If we wont to automatically include information about who rote a particular review we will need to copy sample of the user profile to the particular review and this is the way (to brake data Normalization) specifically in could FireStore.
This question already has answers here:
Firebase android : make username unique
(4 answers)
Closed 5 years ago.
The problem I can't seem to find a straight answer to is how can I do a query on this list in the Firebase database by some field (a username in my case) to find the associated key for that user given that username is guaranteed to be a unique value.
I've read through the documentation on queries, but it looks like all of them need a key in some shape or form is that really the case? And if it is how is this normally avoided?
Thanks a million below is how my DB is designed.
Right now, in my database there is a list of user objects:
Database
-users
-{SomeUniqueKey}
-data: "some data"
-username: "user1"
-usernameThisUserIsFollowing: "user2"
+{SomeOtherUniqueKey}
You may use equalTo.
Reference: https://firebase.google.com/docs/database/