-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
NODE-3833 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 fs = require('fs') const { Stream } = require('stream') const util = require('util') const pipeline = util.promisify(Stream.pipeline) const { MongoClient, GridFSBucket } = require('mongodb') let client async function main(args) { client = await MongoClient.connect(`mongodb://127.0.0.1:27017`); const database = client.db('test1'); const bucket = new GridFSBucket(database, { bucketName: 'aaa' }); const rs = fs.createReadStream('./main.js'); // Read this source file const ws = bucket.openUploadStream('test') await pipeline(rs, ws) } main(process.argv) .then(console.log) .catch(console.error) .finally(async () => { await client.close() console.log('done.') })
MongoServerError: E11000 duplicate key error collection: cortex@n10.aaa.chunks index: files_id_1_n_1 dup key: { files_id: ObjectId('61c36707a7fdb6da482e14b2'), n: 0 }