-
Notifications
You must be signed in to change notification settings - Fork 11
/
users_2.js
50 lines (50 loc) · 1.83 KB
/
users_2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
db.runCommand({
collmod : "movies",
validator : {
$jsonSchema : {
bsonType : "object",
required : ["title", "desc", "genre", "rating", "reviews"],
properties : {
title : {
bsonType : "string",
description : "must be a string and it is required"
},
desc : {
bsonType : "string",
description : "must be a string and it is required"
},
genre : {
bsonType : "array",
description : "must be an array and it is required",
items : {
bsonType : "string",
description : "must be string"
}
},
rating : {
bsonType : "number",
minimum : 1,
maximum : 10,
description : "must be a number and it is required"
},
reviews : {
bsonType : "array",
description : "must be an array and it is required",
items : {
bsonType : "object",
properties : {
user : {
bsonType : "objectId",
description : "Must be an object refers to user"
},
text : {
bsonType : "string",
description : "Must be a string and it is required"
}
}
}
}
}
}
}
})