From 9dcada38be17bdfbba1826a367ca15578b64b63e Mon Sep 17 00:00:00 2001 From: Aditi Khare Date: Wed, 20 Nov 2024 16:37:05 -0500 Subject: [PATCH] use isBsonType --- lib/cast/int32.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/cast/int32.js b/lib/cast/int32.js index 26fd654918..34eeae8565 100644 --- a/lib/cast/int32.js +++ b/lib/cast/int32.js @@ -1,5 +1,6 @@ 'use strict'; +const isBsonType = require('../helpers/isBsonType'); const assert = require('assert'); /** @@ -20,7 +21,7 @@ module.exports = function castInt32(val) { return null; } - const coercedVal = val._bsontype === 'Long' ? val.toNumber() : Number(val); + const coercedVal = isBsonType(val, 'Long') ? val.toNumber() : Number(val); const INT32_MAX = 0x7FFFFFFF; const INT32_MIN = -0x80000000;