[SERVER-12838] invalidForStorage should return actual error Created: 21/Feb/14  Updated: 11/Jul/16  Resolved: 24/Feb/14

Status: Closed
Project: Core Server
Component/s: JavaScript
Affects Version/s: 2.6.0-rc0
Fix Version/s: 2.6.0-rc1

Type: Improvement Priority: Major - P3
Reporter: Asya Kamsky Assignee: Scott Hernandez (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-8391 Pre-flight upgrade tool to check for ... Closed
Backwards Compatibility: Fully Compatible
Participants:

 Description   

upgradeCheck() uses Object.invalidForStorage() and then prints the error that the method returns. Unfortunately it's not a useful message:

> doc1={"foo.bar":1}
{ "foo.bar" : 1 }
> doc2={"$bar":1}
{ "$bar" : 1 }
> Object.invalidForStorage(doc1)
Unknown Error
> Object.invalidForStorage(doc2)
Unknown Error



 Comments   
Comment by Scott Hernandez (Inactive) [ 24/Feb/14 ]

New message:

> Object.invalidForStorage({"$a":1})
DollarPrefixedFieldName: $a is not valid for storage.

Comment by Githook User [ 24/Feb/14 ]

Author:

{u'username': u'scotthernandez', u'name': u'Scott Hernandez', u'email': u'scotthernandez@gmail.com'}

Message: SERVER-12838: return status reason
Branch: master
https://github.com/mongodb/mongo/commit/c1c58e880285c7ecd9eba3cb961068954a017249

Comment by Scott Hernandez (Inactive) [ 21/Feb/14 ]

The caller has to check for null (meaning it is okay) or throw. This how it was designed.

The error messages you are seeing is the generic message, which we could change.

Generated at Thu Feb 08 03:29:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.