Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-4017

Investigate NODE-4016 - NULL-reference error if a property in MapReduce `scope` is `null`

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • Not Needed

      NODE-4016 Description

      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);
      

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: