Inserting using `Map` assumes all keys are strings

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: BSON
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • 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
              Reporter:
              Matt Broadstone
              None
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: