You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's no reason to not upstream the entire error. I tested it by changing the cache file.
Before:
MongoError: "Document failed validation"
at Collection.insertMany (https://deno.land/x/[email protected]/src/collection/collection.ts:192:13)
at async Collection.insertOne (https://deno.land/x/[email protected]/src/collection/collection.ts:149:29)
at async createCampaign (file:///home/jamal/Desktop/side-projects/satiro.co/core/services/create-campaign.service.ts:10:17)
at async Server.<anonymous> (file:///home/jamal/Desktop/side-projects/satiro.co/functions/create-campaign.function.ts:20:24)
at async Server.#respond (https://deno.land/[email protected]/http/server.ts:298:18)
Now:
Error: MongoError: {"index":0,"code":121,"errInfo":{"failingDocumentId":"62ef419eb11a449f45637eed","details":{"operatorName":"$jsonSchema","schemaRulesNotSatisfied":[{"operatorName":"required","specifiedAs":{"required":["id","influencer","product","status","expiredAt","affiliateLink"]},"missingProperties":["id"]}]}},"errmsg":"Document failed validation"}
at Collection.insertMany (https://deno.land/x/[email protected]/src/collection/collection.ts:192:13)
at async Collection.insertOne (https://deno.land/x/[email protected]/src/collection/collection.ts:149:29)
at async createCampaign (file:///home/jamal/Desktop/side-projects/satiro.co/core/services/create-campaign.service.ts:10:17)
at async Server.<anonymous> (file:///home/jamal/Desktop/side-projects/satiro.co/functions/create-campaign.function.ts:20:24)
at async Server.#respond (https://deno.land/[email protected]/http/server.ts:298:18)
With that, I can parse the errors and give some hints to solve the problem when the user is trying to save the document with the wrong schema or handle errors accordingly with its error code.
Hi, first of thank you for the library. Makes life easier working with the mongo on Deno. I am working on the app, which requires the collection validationSchema. As per the new Mongo DB update, the details of this error are sent through the errorInfo field, which is very helpful. can you please help with entire details. Thank you !
Hi, congrats on the project.
I'm having a hard time trying to get errors from the driver, please take a look:
mongo/src/collection/collection.ts
Line 191 in d5445a4
Could we replace that by the following:
There's no reason to not upstream the entire error. I tested it by changing the cache file.
Before:
Now:
With that, I can parse the errors and give some hints to solve the problem when the user is trying to save the document with the wrong schema or handle errors accordingly with its error code.
Update:
We also need to add the
errInfo
to the class just like the nodejs driver: https://github.com/mongodb/node-mongodb-native/blob/417655ac9d87c1c9ca255dfcc81ca828ffde731a/src/error.ts#L171The text was updated successfully, but these errors were encountered: