-
Type: Bug
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: 4.3.1
-
Component/s: CRUD
What problem are you facing?
Passing null as a value of a property of the scope object in mapReduce() ends with a NULL-reference error:
TypeError: Cannot read properties of null (reading '_bsontype') at processScope (.\node_modules\mongodb\lib\operations\map_reduce.js:157:29)
What driver and relevant dependency versions are you using?
4.3.1
Steps to reproduce?
const { MongoClient } = require("mongodb"); const uri = "mongodb://127.0.0.1/"; const client = new MongoClient(uri); async function run() { try { await client.connect(); const database = client.db('test'); const test = database.collection('test'); await test.mapReduce(null, null, {scope: {test: null}, out: 'inline'}); } finally { await client.close(); } } run().catch(console.dir);
- depends on
-
NODE-4017 Investigate NODE-4016 - NULL-reference error if a property in MapReduce `scope` is `null`
- Closed