Advertisement
Guest User

Untitled

a guest
Dec 6th, 2018
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 2.58 KB | None | 0 0
  1. db.createCollection("messages", {
  2.     validator: {
  3.         $jsonSchema: {
  4.             bsonType: "object",
  5.             required: ["_id", "linkId", "body", "score","isRemoved"],
  6.             comment: {
  7.                 _id: {
  8.                     bsonType: "objectId",
  9.                     description: "must be an objectId and is required"
  10.                 },
  11.                 linkId: {
  12.                     bsonType: "objectId",
  13.                     description: "must be an objectId and is required"
  14.                 },
  15.                 body{
  16.                     bsonType: "string",
  17.                     description: "must be a string and is required"
  18.                 },
  19.                 score{
  20.                     bsonType: "int",
  21.                     description: "must be an int and is required"
  22.                 },
  23.                 isRemoved{
  24.                     bsonType: "boolean",
  25.                     description: "must be an boolean and is required"
  26.                 }
  27.             },
  28.             user: {
  29.                 _id: {
  30.                     bsonType: "objectId",
  31.                     description: "must be an objectId and is required"
  32.                 },
  33.                 firstName: {
  34.                     bsonType: "string",
  35.                     description: "must be an string and is required"
  36.                 },
  37.                 lastName: {
  38.                     bsonType: "string",
  39.                     description: "must be an string and is required"
  40.                 },
  41.                 password: {
  42.                     bsonType: "string",
  43.                     description: "must be an string and is required"
  44.                 },
  45.                 activationToken: {
  46.                     bsonType: "string",
  47.                     description: "must be an string and is not required"
  48.                 },
  49.                 resetPasswordToken: {
  50.                     bsonType: "string",
  51.                     description: "must be an string and is not required"
  52.                 },
  53.                 linkSearchHistory: [
  54.                     link:{
  55.                         bsonType: "object",
  56.                         description: "must be an object and is optional",
  57.                         required: ["linkId", "searchDate, "minScore","ammount"],
  58.                         properties: {
  59.                                 linkId:{
  60.                                     bsonType: "objectId",
  61.                                     description: "must be an objectId and is required"
  62.                                 },
  63.                                 searchDate:{
  64.                                     bsonType: "date",
  65.                                     description: "must be an objectId and is required"
  66.                                 },
  67.                                 threadTitle:{
  68.                                     bsonType: "string",
  69.                                     description: "must be an objectId and is not required"
  70.                                 },
  71.                                 minScore:{
  72.                                     bsonType: "int",
  73.                                     description: "must be an objectId and is required"
  74.                                 },
  75.                                 ammount:{
  76.                                     bsonType: "int",
  77.                                     description: "must be an objectId and is required"
  78.                                 }
  79.                         }
  80.                     }
  81.                 ]
  82.             },
  83.             sessions: {
  84.                 _id: {
  85.                     bsonType: "objectId",
  86.                     description: "must be an objectId and is required"
  87.                 },
  88.                 session_id: {
  89.                     bsonType: "string",
  90.                     description: "must be an string and is required"
  91.                 },
  92.                 session_attributes{
  93.                     bsonType: "string",
  94.                     description: "must be an string and is required"
  95.                 }
  96.             }
  97.         }
  98.     }
  99. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement