File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -359,6 +359,17 @@ describe("Individual operator tests", function() {
359
359
expect ( coll . find ( { "c" : { $eq : undefined } } ) . length ) . toEqual ( 4 ) ;
360
360
} ) ;
361
361
362
+ it ( 'query nested documents with nullable object' , function ( ) {
363
+ var db = new loki ( 'db' ) ;
364
+ var coll = db . addCollection ( 'coll' ) ;
365
+
366
+ coll . insert ( { a : null , b : 5 , c : { a : 1 } } ) ;
367
+ coll . insert ( { a : "11" , b : 5 , c : { a : 1 } } ) ;
368
+ coll . insert ( { a : "11" , b : 5 , c : null } ) ;
369
+
370
+ expect ( coll . find ( { "c.a" : { $eq : 1 } } ) . length ) . toEqual ( 2 ) ;
371
+ } ) ;
372
+
362
373
it ( '$exists ops work as expected' , function ( ) {
363
374
var db = new loki ( 'db' ) ;
364
375
var coll = db . addCollection ( 'coll' ) ;
Original file line number Diff line number Diff line change 415
415
416
416
var valueFound = false ;
417
417
var element ;
418
- if ( typeof root === 'object' && path in root ) {
418
+ if ( root !== null && typeof root === 'object' && path in root ) {
419
419
element = root [ path ] ;
420
420
}
421
421
if ( pathOffset + 1 >= paths . length ) {
You can’t perform that action at this time.
0 commit comments