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

problem inserting document having validation of bsontype int and bsontype array

    • Type: Icon: Bug Bug
    • Resolution: Won't Do
    • Priority: Icon: Major - P3 Major - P3
    • No version
    • Affects Version/s: None
    • Component/s: Schema Validation
    • None
    • Not Needed

      Hello, 

      im trying to insert a document containing some int, string and an array.

      I have a validation schema :like this

      numbers:

      { bsonType: [ 'int' ], description: '' }

      ,

      data: {
      bsonType: [
      'array'
      ],
      minItems: 1,
      uniqueItems: true,
      additionalProperties: false,
      items: {
      bsonType: [
      'object'
      ],
      required: [
      'idData',
      'dataName'
      ],
      additionalProperties: false,
      properties: {
      idData:

      { bsonType: [ 'objectId' ], description: '' }

      ,
      dataName:

      { bsonType: 'string', description: '' }

      }
      }
      }

       

       

      If i try to insert a document containing int and array it fails validation, 

      if i insert the same document , but  change the bsontype of numbers from 'int' to 'double'

      the validation goes ok and the document is inserted.

      Can u help pls?

       

      this is the document i try to insert :

       

      {    {        "numbers": 2,     "data": [

      {         "idData":new ObjectId(), "dataName": "name"        }

          ]
      }

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            rauseom@libero.it marco ruseo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: