Read Mongodb shell error details

Hi everyone, I am trying to read the details object, how can I achieve this via mongo sh?

MongoServerError: Document failed validation
Additional information: {
  failingDocumentId: ObjectId("62e4068f266bd3be3f21150b"),
  details: {
    operatorName: '$jsonSchema',
    schemaRulesNotSatisfied: [
        operatorName: 'properties',
        propertiesNotSatisfied: [
          { propertyName: 'color', details: [ [Object] ] },
          { propertyName: 'age', details: [ [Object] ] },
          { propertyName: 'gender', details: [ [Object] ] }
        operatorName: 'required',
        specifiedAs: {
          required: [ 'name', 'title', 'occupation' ]
        missingProperties: [ 'name' ]

Hi @Abejide_N_A, welcome to the community.
The default level of inner elements that mongosh outputs is set to 6. That means elements that are less than 6 levels deep will only be shown in the shell.
However, you can change this behavior in your mongosh config file by specifying the level till which output gets printed.
For example, you want to print the output till level 10, you can specify the same in your config file like this:

  inspectDepth: 10

Alternatively, you can also utilize the config API in mongosh by executing the following command to achieve the same:

config.set("inspectDepth", 10)

Please note that settings specified using the config API will override the default configuration as well as the configuration mentioned in your mongosh config file for that corresponding key.

If you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,


This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.