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

MacOS - MongoServerError: E11000 duplicate key error collection in chunks collection

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.6.0
    • Affects Version/s: 4.2.2
    • Component/s: None
    • 2
    • Not Needed

      What problem are you facing?

      Unable to upload files with GridFSBucket in MacOS only. Works fine in Linux.

      What driver and relevant dependency versions are you using? 

      mongodb@4.2.2

      Steps to reproduce?

      const { Stream} = require('stream')
      const util = require('util')
      pipeline = util.promisify(Stream.pipeline);

       const { MongoClient, GridFSBucket } = require('mongodb');

      client = await MongoClient.connect(`mongodb://...`, {useNewUrlParser: true, useUnifiedTopology: true});

      const database = client.db('test1');
      const bucket = new GridFSBucket(database, { bucketName: 'aaa' });

      rs = fs.createReadStream('/var/tmp/test.txt');
      ws = bucket.openUploadStream('test')
      await pipeline(rs, ws)

       

      MongoServerError: E11000 duplicate key error collection: cortex@n10.aaa.chunks index: files_id_1_n_1 dup key: { files_id: ObjectId('61c36707a7fdb6da482e14b2'), n: 0 }

            Assignee:
            daria.pardue@mongodb.com Daria Pardue
            Reporter:
            farhad.abar@gmail.com Farhad Abar
            Neal Beeken
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: