Converting type names to numbers in doc validation rule builder makes JSON less readable

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Major - P3
    • 1.18.0
    • Affects Version/s: None
    • Component/s: UI / UX
    • None
    • None

      I created doc validation rules using type names (see attached) but Compass then converts them to the numeric equivalent in the JSON output and the rule that's added to MongoDB. It would be simpler for people to understand the rules if Compass kept the name instead.

      rules.js
      {
        "name": {
          "$type": 3
        },
        "name.first": {
          "$type": 2
        },
        "name.last": {
          "$type": 1
        },
        "social.twitter": {
          "$type": 4
        }
      }
      
      db.getCollectionInfos({name:"people"})
      [
      	{
      		"name" : "people",
      		"type" : "collection",
      		"options" : {
      			"validator" : {
      				"name" : {
      					"$type" : 3
      				},
      				"name.first" : {
      					"$type" : 2
      				},
      				"name.last" : {
      					"$type" : 1
      				},
      				"social.twitter" : {
      					"$type" : 4
      				}
      			},
      			"validationLevel" : "strict",
      			"validationAction" : "error"
      		},
      		"info" : {
      			"readOnly" : false
      		},
      		"idIndex" : {
      			"v" : 2,
      			"key" : {
      				"_id" : 1
      			},
      			"name" : "_id_",
      			"ns" : "clusterdb.people"
      		}
      	}
      ]
      

      Scope of the ticket:

      • change type value to its string alias
      • change tests to reflect this

        1. object_checks.png
          43 kB
          Andrew Morgan

            Assignee:
            Unassigned
            Reporter:
            Andrew Morgan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: