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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 4.2.2
    • 4.6.0
    • None
    • 2
    • Not Needed

    Description

      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 }

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: