-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 4.0.0
-
Component/s: None
What problem are you facing?
const { MongoClient } = require('mongodb'); (async() => { const client = await MongoClient.connect('mongodb://localhost/'); const db = client.db('testvalidation' + Date.now()); const coll = await db.createCollection('contacts', { validator: { $and: [ { phone: { $type: "string" } }, { email: { $regex: /@mongodb\.com$/ } }, { status: { $in: [ "Unknown", "Incomplete" ] } } ] } }); try { await coll.insertOne({ email: "test@mongodb.com", status: "Unknown" }); } catch (err) { console.dir(err, { depth: Infinity }); // err.errInfo.details.clausesNotSatisfied is helpful error information } try { await coll.insertMany([{ email: "test@mongodb.com", status: "Unknown" }]); } catch (err) { console.dir(err, { depth: Infinity }); // that information is missing here } await client.close(); })();
What driver and relevant dependency versions are you using?
4.0.0 driver, 5.0.0 server
Steps to reproduce?
See above, information present for insertOne is missing from the insertMany result.
- is depended on by
-
MONGOSH-894 Reasons for document validation failure is not reported for insertMany()
- Closed