mongodb - How to delete depricated string fields in options document? -
lets have collections 'testcol' document validation options in options document.
{      "name" : "testcol",      "type" : "collection",      "options" : {          "validator" : {              "$or" : [                  {                      "phone" : {                          "$type" : "string"                      }                  },              ]          },          "validationlevel" : "moderate",          "validationaction" : "error"      },      ... }   lets want delete these options (i aware can set 'validationlevel' 'off'). can run db.runcommand('colmod'': testcol', validator: {}) , mongodb delete field 'validator' options document. can't same 'validationlevel' , 'validationaction'. db.runcommand('colmod'': testcol', validationlevel: ''), not change leaves me this:
{         "name" : "testcol",         "type" : "collection",         "options" : {             "validationlevel" : "moderate",             "validationaction" : "error"         },         ... }   this unclean! there way rid of deprecated string-field options or way manipulate/access options document of collection directly?
 
 
Comments
Post a Comment