@@ -153,7 +153,7 @@ To access properties of a type in an expression, use the `this` variable (e.g.
153
153
"posts" : {
154
154
".read" : " true" ,
155
155
"$id" : {
156
- ".validate" : " newData.hasChildren(['message', 'from']) && newData.child('message').val().length <= 140" ,
156
+ ".validate" : " ( newData.hasChildren(['message', 'from']) && newData.child('message').val().length <= 140) " ,
157
157
"message" : {
158
158
".validate" : " newData.isString()"
159
159
},
@@ -203,7 +203,7 @@ type Person {
203
203
".validate" : " newData.isBoolean()"
204
204
},
205
205
"extra" : {
206
- ".validate" : " newData.hasChildren() || newData.val() == null "
206
+ ".validate" : " newData.hasChildren()"
207
207
},
208
208
"$other" : {
209
209
".validate" : " false"
@@ -252,7 +252,7 @@ This example compiles to:
252
252
"$id" : {
253
253
".validate" : " newData.hasChildren(['name', 'isAdmin'])" ,
254
254
"name" : {
255
- ".validate" : " newData.isString() && newData.val().length > 0 && newData.val().length <= 32"
255
+ ".validate" : " (( newData.isString() && newData.val().length > 0) && newData.val().length <= 32) "
256
256
},
257
257
"isAdmin" : {
258
258
".validate" : " newData.isBoolean()"
@@ -266,7 +266,7 @@ This example compiles to:
266
266
"$id" : {
267
267
".validate" : " newData.hasChildren(['name', 'creator'])" ,
268
268
"name" : {
269
- ".validate" : " newData.isString() && newData.val().length > 0 && newData.val().length <= 32"
269
+ ".validate" : " (( newData.isString() && newData.val().length > 0) && newData.val().length <= 32) "
270
270
},
271
271
"creator" : {
272
272
".validate" : " newData.isString()"
@@ -311,13 +311,13 @@ isCurrentUser(uid) { auth != null && auth.uid == uid }
311
311
".validate" : " newData.isString()"
312
312
},
313
313
"age" : {
314
- ".validate" : " newData.isNumber() || newData.val() == null "
314
+ ".validate" : " newData.isNumber()"
315
315
},
316
316
"$other" : {
317
317
".validate" : " false"
318
318
},
319
319
".read" : " true" ,
320
- ".write" : " auth != null && auth.uid == $userid"
320
+ ".write" : " ( auth != null && auth.uid == $userid) "
321
321
}
322
322
}
323
323
}
@@ -409,10 +409,10 @@ Note the special function `prior(ref)` - returns the previous value stored at a
409
409
".validate" : " newData.isString()"
410
410
},
411
411
"modified" : {
412
- ".validate" : " newData.isNumber() && newData.val() == now"
412
+ ".validate" : " ( newData.isNumber() && newData.val() == now) "
413
413
},
414
414
"created" : {
415
- ".validate" : " newData.isNumber() && newData.val() == (data.val() == null ? now : data.val())"
415
+ ".validate" : " ( newData.isNumber() && newData.val() == (data.val() == null ? now : data.val() ))"
416
416
},
417
417
"$other" : {
418
418
".validate" : " false"
@@ -472,10 +472,10 @@ initial(value, init) { value == (prior(value) == null ? init : prior(value)) }
472
472
".validate" : " false"
473
473
},
474
474
"modified" : {
475
- ".validate" : " newData.isNumber() && newData.val() == now"
475
+ ".validate" : " ( newData.isNumber() && newData.val() == now) "
476
476
},
477
477
"created" : {
478
- ".validate" : " newData.isNumber() && newData.val() == (data.val() == null ? now : data.val())"
478
+ ".validate" : " ( newData.isNumber() && newData.val() == (data.val() == null ? now : data.val() ))"
479
479
},
480
480
".read" : " true" ,
481
481
".write" : " true"
@@ -561,36 +561,37 @@ createOnly(value) { prior(value) == null && value != null }
561
561
"$key1" : {
562
562
".validate" : " newData.isString()"
563
563
},
564
+ ".validate" : " newData.hasChildren()" ,
564
565
".read" : " auth != null"
565
566
},
566
567
"members" : {
567
568
"$room_id" : {
568
- ".read" : " auth != null && root.child('members').child($room_id).child(auth.uid).val() != null" ,
569
+ ".read" : " ( auth != null && root.child('members').child($room_id).child(auth.uid).val() != null) " ,
569
570
"$user_id" : {
570
- ".validate" : " newData.val().length > 0 && newData.val().length < 20" ,
571
- ".write" : " auth != null && auth.uid == $user_id"
571
+ ".validate" : " ( newData.val().length > 0 && newData.val().length < 20) " ,
572
+ ".write" : " ( auth != null && auth.uid == $user_id) "
572
573
}
573
574
}
574
575
},
575
576
"messages" : {
576
577
"$room_id" : {
577
578
".validate" : " root.child('room_names').child($room_id).val() != null" ,
578
- ".read" : " auth != null && root.child('members').child($room_id).child(auth.uid).val() != null" ,
579
+ ".read" : " ( auth != null && root.child('members').child($room_id).child(auth.uid).val() != null) " ,
579
580
"$message_id" : {
580
581
".validate" : " newData.hasChildren(['name', 'message', 'timestamp'])" ,
581
582
"name" : {
582
- ".validate" : " newData.val().length > 0 && newData.val().length < 20"
583
+ ".validate" : " ( newData.val().length > 0 && newData.val().length < 20) "
583
584
},
584
585
"message" : {
585
- ".validate" : " newData.isString() && newData.val().length > 0 && newData.val().length < 50"
586
+ ".validate" : " (( newData.isString() && newData.val().length > 0) && newData.val().length < 50) "
586
587
},
587
588
"timestamp" : {
588
- ".validate" : " newData.isNumber() && newData.val() == now"
589
+ ".validate" : " ( newData.isNumber() && newData.val() == now) "
589
590
},
590
591
"$other" : {
591
592
".validate" : " false"
592
593
},
593
- ".write" : " data.val() == null && newData.val() != null && (auth != null && root.child('members').child($room_id).child(auth.uid).val() != null)"
594
+ ".write" : " (( data.val() == null && newData.val() != null) && (auth != null && root.child('members').child($room_id).child(auth.uid).val() != null) )"
594
595
}
595
596
}
596
597
}
0 commit comments