Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-274

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

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 1.18.0
    • None
    • UI / UX
    • None

    Description

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            andrew.morgan@mongodb.com Andrew Morgan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: