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

Inserting using `Map` assumes all keys are strings

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: BSON
    • None

      When executing the following code:

      MongoClient.connect('mongodb://localhost', (err, client) => {
        assert.ok(client);
        const coll = client.db('test').collection('foo');
        const ordered = new Map([
          [ 'a', 1 ],
          [ 'z', 2 ],
          [ 42, 3 ]
        ]);
      
        coll.insert(ordered, (err, res) => {});
      });
      

      you will receive a TypeError: keys.match does not exist because of this line of code which expects all keys in a Map to be a string

            Assignee:
            sophie.saskin@mongodb.com Sophie Saskin
            Reporter:
            matt.broadstone@mongodb.com Matt Broadstone
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: