parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Collection and index name not visible when duplicate value for a unique field is encountered

Open RahulLanjewar93 opened this issue 1 month ago â€ĸ 4 comments

New Issue Checklist

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

RahulLanjewar93 avatar Oct 27 '25 18:10 RahulLanjewar93

🚀 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 avatar Oct 27 '25 18:10 RahulLanjewar93

@RahulLanjewar93 happy to review a PR if you open one.

mtrezza avatar Nov 08 '25 18:11 mtrezza

@mtrezza done

RahulLanjewar93 avatar Nov 08 '25 20:11 RahulLanjewar93

🎉 This change has been released in version 9.1.0-alpha.4

parseplatformorg avatar Dec 14 '25 15:12 parseplatformorg

🎉 This change has been released in version 9.1.0

parseplatformorg avatar Dec 14 '25 15:12 parseplatformorg