instanceof keyword is not working as intended

Christian Lindgren shared this problem 19 months ago
Solved

Hi,

The `instanceof` keyword is not working as intended for some instances of type Object.

See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof#Examples


Node.js cli

const obj = {a: {x: 't1'}, b: {y: 't2'}}
console.log(typeof obj)                 // object
console.log(typeof obj.a)               // object
console.log(typeof obj['a'])            // object
console.log(obj instanceof Object)      // true
console.log(obj.a instanceof Object)    // true
console.log(obj['a'] instanceof Object) // true
const date = new Date()
console.log(typeof date)                // object
console.log(date instanceof Object)     // true
console.log(date instanceof Date)       // true
NoSQLBooster


const obj = {a: {x: 't1'}, b: {y: 't2'}}
console.log(typeof obj)                 // object
console.log(typeof obj.a)               // object
console.log(typeof obj['a'])            // object
console.log(obj instanceof Object)      // false
console.log(obj.a instanceof Object)    // false
console.log(obj['a'] instanceof Object) // false
const date = new Date()
console.log(typeof date)                // object
console.log(date instanceof Object)     // true
console.log(date instanceof Date)       // true

Best regards,


Christian

Best Answer
photo

Thank you for your feedback.

We have worked out a new test build to resolve the issue, please download and give it a try.

Linux AppImage: https://s3.mongobooster.com/download/releasesv4/nosqlbooster4mongo-4.5.3.AppImage

Comments (3)

photo
1

Thank you for your feedback.

We have worked out a new test build to resolve the issue, please download and give it a try.

Linux AppImage: https://s3.mongobooster.com/download/releasesv4/nosqlbooster4mongo-4.5.3.AppImage

photo
1

Thanks for the quick response!

I'll have a go with it tomorrow and give you some feedback afterwards.

photo
1

The linked build fixes the issue, thanks!