How to test Delete in Firebase Realtime Database Rules Playground - 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.

Related

Which Realtime Database instance I need for Firebase Delete User Data extension

I'm trying to install the Firebase Delete User Data extension. I only use Firestore so I don't need Realtime Database but to configure the extension, an instance of the realtime database is required.
I have the realtime database disabled. In order to finish the installation of the extension I have put the name of my firebase project to test.
Question: What instance do I really have to introduce if I don't use the realtime database?
Thanks in advance.
Hmm... that looks like something they should change in the extension, so I recommend filing a report on the [Github repo](https://github.com/firebase/extensions.
For the moment, you'll have to create a Realtime Database instance in the console, and then select it here. You can select completely disabled security rules for the database, to ensure nobody can write data to it from the client-side SDKs.

firebase deleting a document deletes its subcollections in console?

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

Referencing Firebase realtime database data through firestore security rules

I would like to use data in the realtime database to allow user access in the firestore database. Is it possible to reference nodes in the realtime database from the firestore security rules?
It is currently not possible to cross between database products like this in security rules. Please feel free to file a feature request for this.
You can, however, write code to run on Cloud Functions that deals with database changes after the change has happened, and undo or restrict the change there.

Is there a way to perform a transaction that writes to auth, firestore and storage

I'm new to firebase and I want to add it to my vuejs project.
But I'm wondering. Is the a way I can perform a transaction that creates user using the auth() and use the uid to create a user using firestore() and use the uid as a name to upload an image using storage(). However, the whole operation should revert, should any fail.
There are no cross-product transactions available for Firebase products. Of the three products you mentioned, only Firestore has transactions, and they are limited to documents within a single database.
What you will have to do is check for errors each step of the way, and undo any previous changes if something fails.

How do I update a list in flutter app everytime a new child is added in firebase realtime database

I have a flutter application in which I need to update the list in realtime every time a new child is added to the database. I have tried looking for it everywhere but nothing is working. Please provide an example code to implement it.
Check out this post about CRUD operations with firebase. What you are looking for is basically the Read part. Using a stream to listen to the changes made in your firebase reference.

Resources