Collection and index name not visible when duplicate value for a unique field is encountered
New Issue Checklist
- Report security issues confidentially.
- Any contribution is under this license.
- Before posting search existing issues.
Issue Description
Parse throws the below error if an object is created where the collection has unique index and there is conflict. https://github.com/parse-community/parse-server/blob/00f8d4cda96d2f77535cac6db8037daba219d2db/src/Adapters/Storage/Mongo/MongoStorageAdapter.js#L578
Steps to reproduce
Actual Outcome
The error is meaningless because its difficult to trace back which class or the index had the conflict can use regex to abstract the information from the error. I have removed sensitive information from the error. E11000 duplicate key error collection: db.collectionName index: index_name_1 dup key: { field: "value", name: "voluptatem" }
Expected Outcome
We should add proper collectionName and indexName along with the error?
Environment
Server
- Parse Server version:
7 - Operating system:
na - Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc):
na
Database
- System (MongoDB or Postgres):
Mongo - Database version:
na - Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc):
Local
Client
- SDK (iOS, Android, JavaScript, PHP, Unity, etc):
js - SDK version:
6
Logs
đ Thanks for opening this issue!
âšī¸ You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.
@mtrezza i think this was not implement so that this error is not propogated to the frontend? but it becomes difficult on backend to cross check where this issue arised from. If we are not supposed to add the collection and index name to the error maybe we can do a simple logging so devs can fix it. Happy to open the pr
@RahulLanjewar93 happy to review a PR if you open one.
@mtrezza done
đ This change has been released in version 9.1.0-alpha.4
đ This change has been released in version 9.1.0