@@ -258,6 +258,19 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
258
258
const uuid = require ( 'uuid' ) ;
259
259
const uuid1 = uuid . v4 ( ) ;
260
260
const uuid2 = uuid . v4 ( ) ;
261
+ const schema = {
262
+ className : 'MyClass' ,
263
+ fields : {
264
+ x : { type : 'Number' } ,
265
+ count : { type : 'Number' } ,
266
+ } ,
267
+ classLevelPermissions : { } ,
268
+ } ;
269
+
270
+ const myClassSchema = new Parse . Schema ( schema . className ) ;
271
+ myClassSchema . setCLP ( schema . classLevelPermissions ) ;
272
+ await myClassSchema . save ( ) ;
273
+
261
274
const query = {
262
275
x : 1 ,
263
276
} ;
@@ -266,7 +279,6 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
266
279
__op : 'SetOnInsert' ,
267
280
amount : uuid1 ,
268
281
} ,
269
- x : 1 ,
270
282
count : {
271
283
__op : 'Increment' ,
272
284
amount : 1 ,
@@ -285,12 +297,16 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
285
297
update ,
286
298
{ upsert : true } ,
287
299
) ;
288
- const q = new Parse . Query ( 'MyClass' ) ;
289
- const docs = await q . find ( ) ;
290
- expect ( docs . length ) . toBe ( 1 ) ;
291
- expect ( docs [ 0 ] . id ) . toBe ( uuid1 ) ;
292
- expect ( docs [ 0 ] . get ( 'x' ) ) . toBe ( 1 ) ;
293
- expect ( docs [ 0 ] . get ( 'count' ) ) . toBe ( 2 ) ;
300
+
301
+ const res = await Parse . Server . database . find (
302
+ schema . className ,
303
+ { } ,
304
+ { } ,
305
+ ) ;
306
+ expect ( res . length ) . toBe ( 1 ) ;
307
+ expect ( res [ 0 ] . objectId ) . toBe ( uuid1 ) ;
308
+ expect ( res [ 0 ] . count ) . toBe ( 2 ) ;
309
+ expect ( res [ 0 ] . x ) . toBe ( 1 ) ;
294
310
} ) ;
295
311
296
312
it ( 'handles updating a single object with array, object date' , done => {
0 commit comments