0

In Stitch -> rules, I open up MyCollection, clicked on the Schema tab, and typed the following:

{
  "bsonType": "object",
  "required": [
    "roadmapTitle"
  ],
  "properties": {
    "roadmapTitle": {
      "bsonType": "string"
    },
    "creatorId": {
      "bsonType": "objectId"
    }
  }
}

Saved & Deployed. However, if I insert a document like MyCollection.insertOne({nothing here: "hehe"}), the Log shows okay, the object is stored, no error is caught. Interestingly though, running the validate function next to "edit schema" in the Schema field shows that all of those documents failed schema validation. Did I miss a step in enforcing the Schema validation on document insertion?

Acy
  • 589
  • 2
  • 9
  • 25
  • Highly likely because I ran the tests as system user instead of a normal user. System user can bypass Schema – Acy Apr 22 '20 at 05:41
  • Previous comment confirmed, Schema Validation performs expectedly. – Acy Apr 22 '20 at 05:52

0 Answers0