Is there a way around this, but what I know so far is that the database rules do not support numChildren() to read the number of child nodes.
Some other suggestions are to use a custom counter that increments every time I write a child node, but this is difficult to implement since children can be added or removed by many different methods.
One possible way is to re-read all data from that node and count the number of child nodes before sending a request to write new node to database. But my parent node data is quite large and writes are quite frequent so re-reading the node every time can increase the cost. Anyone who has experience in this, can let me know your solution.