Advertisement
Guest User

Schema validation (query operators)

a guest
Oct 14th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. db.createCollection("publishers", {
  2. validator: {
  3. $and: [
  4. { name: { $type: "string" } },
  5. { $and: [ { email_address: { $exists: true } }, { email_address: { $type: "string" } } ] },
  6. { status: { $in: [ 1, 0 ] } },
  7. { $and: [ { created_at: { $exists: true } }, { created_at: { $type: "int" } } ] }
  8. ]
  9. }
  10. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement