[SERVER-82882] Indicate which field/keys are the issue in the error message Created: 07/Nov/23  Updated: 09/Jan/24

Status: Investigating
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Jean-Samuel Girard Assignee: Edwin Zhou
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Server Triage
Participants:

 Description   

When working with documents that have a lot of fields and dynamically typed fields it may not be immediately obvious which 2 or more fields contain array values, the error should indicate which fields are the issue



 Comments   
Comment by Jean-Samuel Girard [ 09/Jan/24 ]

Yes, if the error is formatted as shown if the above comment it's all good for me.

I cannot test it on the latest version of mongoDB because we're still in development on a shared cluster, but I'm happy to hear it won't be an issue when we upgrade.

Comment by Edwin Zhou [ 08/Jan/24 ]

Hi jean-samuel.girard@kiwi.ca,

If this is still an issue for you, would you please inform us if my colleague's comment resolves your issue?

Kind regards,
Edwin

Comment by Eric Sedor [ 13/Dec/23 ]

Hi jean-samuel.girard@kiwi.ca,

This error message is improved in recent versions of MongoDB to provide the kind of clarity you're looking for:

replset:PRIMARY> db.test.insert({a:[1,2],b:[4,3]})
WriteResult({ "nInserted" : 1 })
replset:PRIMARY> db.test.createIndex({a:1,b:1})
{
	"ok" : 0,
	"errmsg" : "Index build failed: 059f8946-3444-47c2-8be5-c25367507a41: Collection test.test ( 45e2a644-4125-45ac-ac11-8849978a2cfd ) :: caused by :: cannot index parallel arrays [b] [a]",
	"code" : 171,
	"codeName" : "CannotIndexParallelArrays",
	"$clusterTime" : {
		"clusterTime" : Timestamp(1702486227, 5),
		"signature" : {
			"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
			"keyId" : NumberLong(0)
		}
	},
	"operationTime" : Timestamp(1702486227, 5)
}

Does this help?

Sincerely,
Eric

Generated at Thu Feb 08 06:50:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.