Is it possible to enforce the votes array to have exactly 5 entries?
newData.child('votes').val().length === 5) doesn't seem to work as the length property only works with strings. Here is my data:
votes
$voteID
page:"12345"
user: "facebook:1234567"
votes: {
-K3M2kpTEtXRk-sHV6FO: true
-K3M2kp_5vZDCZKUke2M: true
-K3M2kpe7l22mYA1dc6D: true
-K3M2kqhpgehSSUAcFLl: true
-K3M2krABl2tU-cekpDA: true
}
Is it possible at all to enforce this validation ?
How about
"!newData.hasChild('X')"
where X is the length you want +1
and for further validation like you specified you can always do
"$index" : {
".validate" : "... some validation .. "
}
so my answer does not limit you in any way and can support to any array limit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With