I'm confused when I read firebase document says that :
Deleting a document does not delete its subcollections!
but this isn't the normal in the firebase console now, I can see when I delete a doc from the console all subcollections that belong to it also gone.
on the other side, the firebase emulator doesn't delete the subcollection and just remove any existing fields on the doc and keep the subcollections in place
I think 🤔 they was referring to giving end user the permission to delete data directly in your app and think it will be a more secure way if they delete data from the app through a Callable function that can be call recursively
Hope this help clearly your doubt
Related
I want to implement a badge system into my Firebase project, but I already have a lot of users. I want to take all the UIDs of my existing users, and create a new corresponding document for them in my new collection, userinfo.
I've searched the docs and I cannot find a way to do this. Can I get some help creating the documents?
If you want to create a new document for each user that already exists in the (users) collection to another (userinfo) collection, then you have to read all documents from the "users" collection and perform a write operation in the "userinfo" collection. But bear in mind to not perform such an operation on the client, but in a trusted environment, such as a server that you control, or using Cloud Functions for Firebase.
In Firebase Realtime database console, I see two rules that are confusing to me. One is named "delete" and the other is "set". Below are two snips of the console:
In the end, all I want to prevent anyone from deleting a node. Thank you!
There is no .delete rule in Firebase Realtime Database security rules. If you want to allow/disallow deletes, you can use the data and newData variables. Check for an example the documentation on existing data vs new data.
To test deletion in the playground, you can set or update the value of a node to null. This also applies to any code that write through the API: setting a node to null deletes that node from the database.
I am working on online noticeboard app. I have a collection called notices and there is notices with expires date. i want to move them to another collection after the expiration. How can I do it?
There is no server-side "move" operation in Cloud Firestore. You'll have to read the document, write a copy to its new location, and then delete the original.
If you want to do this atomically, you can do all of these in a transaction.
Also see:
How to move a firestore document from cloud functions?
I'm using Realtime Database in Firebase and by accident I clicked on Cloud Firestore. Since then whenever I want to access Realtime Database it defaults to Cloud Firestore and I have to click and choose the database I'm using, super annoying. Is there a way to disable or delete it?
Is there a way to disable or delete it?
There is no way you can disable either Cloud Firestore or Firebase realtime database from your Firebase console. The simplest solution I can think of, is to save a bookmark in your browser pointing to:
https://console.firebase.google.com/project/firebaseProjectId/database/yourProjectName/data
You can also copy and paste the url that you need and it will point directly to your Firebase realtime database project. In this way you'll skip the initial steps.
I am understand that we have been charges for every read, write and delete operation, but my question are these operation also being counted in the firebase console?
Sometimes, we just wanna see the data through firebase console, and when click at the collection, it will automatically display the documents data and also sub-collection of the documents. Are we gonna get charged through activity in console too?
Are these operation also being counted in the firebase console?
Yes, all read, write or delete operations performed even from the cosole are counted.
Are we gonna get charged through activity in console too?
Yes.