As per suggested by Frank van Puffelen
I have changed my data structure as following
and also updated Firebase rules as following
{
"rules": {
".read": "auth != null",
".write": "auth != null",
"categories": {
"$categorie":{
".validate": "!data.exists()"
}
}
}
}
Now it's not inserting data if data is already there.
Thanks Frank van Puffelen