File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 387387 return this ;
388388 } ,
389389
390+ /**
391+ * Add a constraint to the query that requires a particular
392+ * <strong>array</strong> key's length to be equal to the provided value.
393+ * @param {String } key The array key to check.
394+ * @param value The length value.
395+ * @return {AV.Query } Returns the query, so you can chain this call.
396+ */
397+ sizeEqualTo : function ( key , value ) {
398+ this . _addCondition ( key , "$size" , value ) ;
399+ } ,
400+
390401 /**
391402 * Add a constraint to the query that requires a particular key's value to
392403 * be not equal to the provided value.
Original file line number Diff line number Diff line change @@ -141,6 +141,25 @@ describe("Queries",function(){
141141 throw error ;
142142 }
143143 } ) ;
144+
145+
146+ it ( "sizeEqualTo" , function ( done ) {
147+ var gameScore = new GameScore ( ) ;
148+ gameScore . save ( {
149+ players : [ "a" , "b" ]
150+ } ) . then ( function ( ) {
151+ query = new AV . Query ( GameScore ) ;
152+ query . sizeEqualTo ( "players" , 2 ) ;
153+ query . first ( {
154+ success : function ( object ) {
155+ expect ( object . get ( 'players' ) . size ) . to . be ( 2 ) ;
156+ done ( ) ;
157+ } ,
158+ error : function ( error ) {
159+ throw error ;
160+ }
161+ } ) ;
162+ } ) ;
144163 } ) ;
145164 } ) ;
146165
You can’t perform that action at this time.
0 commit comments