-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 4.2.2
-
Component/s: None
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 }