Você está na página 1de 4

Atividade 08

----Inserção dos Alunos-----


db.Aluno.insertMany([
{nroAluno: 051135593, nomeAluno:"Maria White", formacao: "English",nivel:
"SR",idade: 21},
{nroAluno: 060839453, nomeAluno:"Charles Harris", formacao: "Architecture",nivel:
"Br",idade: 22}]);

----Inserção dos Professores-----


db.professor.insertMany([
{idProf: 142519864, nomeProf: "Ivana Teach",idDepto: 20},
{idProf: 242518965, nomeProf: "James Smith",idDepto: 25}]);

----Inserção dos Cursos-----


db.Curso.insertMany([
{nome:"Data Structures", horario:"MWF 10", sala:"R128", idProf: 242518965},
{nome:"Database Systems", horario:"MWF 12:30-1:45", sala:"1320 DCL", idProf:
142519864}]);

----Inserção dos Matriculados-----


db.Matriculado.insertMany([
{nroAluno:091135583, nomeCurso:"Database Systems"},
{nroAluno:081135573, nomeCurso:"NULL"}]);

-----Tabela Aluno------
{
"_id" : ObjectId("61f8501d135b547f1f09a7a4"),
"nroAluno" : 51135593,
"nomeAluno" : "Maria White",
"formacao" : "English",
"nivel" : "SR",
"idade" : 21
}
{
"_id" : ObjectId("61f8501d135b547f1f09a7a5"),
"nroAluno" : 60839453,
"nomeAluno" : "Charles Harris",
"formacao" : "Architecture",
"nivel" : "Br",
"idade" : 22
}
----Validador para Aluno------
{
$jsonSchema: {
required: [
'nroAluno',
'nomeAluno',
'formacao',
'nivel',
'idade'
],
properties: {
nroAluno: {
bsonType: 'int',
description: 'must be a int and is required',
uniqueItems: true
},
nomeAluno: {
bsonType: 'string',
description: 'must be a string and is required'
},
formacao: {
bsonType: 'string',
description: 'must be a string and is required'
},
nivel: {
bsonType: 'string',
description: 'must be a string and is required'
},
idade: {
bsonType: 'int',
maximum: 125,
description: 'must be a int and is required. Max is 125'
}
}
}
}

-----Tabela Curso------
{
"_id" : ObjectId("61f852e9135b547f1f09a7a8"),
"nome" : "Data Structures",
"horario" : "MWF 10",
"sala" : "R128",
"idProf" : 242518965
}
{
"_id" : ObjectId("61f852e9135b547f1f09a7a9"),
"nome" : "Database Systems",
"horario" : "MWF 12:30-1:45",
"sala" : "1320 DCL",
"idProf" : 142519864
}
----Validador para Curso------
{
$jsonSchema: {
required: [
'nome',
'horario',
'sala',
'idProf'
],
properties: {
nome: {
bsonType: 'string',
description: 'must be a string and is required',
uniqueItems: true
},
horario: {
bsonType: 'string',
description: 'must be a string and is required'
},
sala: {
bsonType: 'string',
description: 'must be a string and is required'
},
idProf: {
bsonType: 'int',
description: 'must be a int and is required'
}
}
}
}

-----Tabela Matriculado------
{
"_id" : ObjectId("61f852e9135b547f1f09a7a8"),
"nome" : "Data Structures",
"horario" : "MWF 10",
"sala" : "R128",
"idProf" : 242518965
}
{
"_id" : ObjectId("61f852e9135b547f1f09a7a9"),
"nome" : "Database Systems",
"horario" : "MWF 12:30-1:45",
"sala" : "1320 DCL",
"idProf" : 142519864
}
> db.matriculado.find().pretty()
> db.Matriculado.find().pretty()
{
"_id" : ObjectId("61f8543d135b547f1f09a7aa"),
"nroAluno" : 91135583,
"nomeCurso" : "Database Systems"
}
{
"_id" : ObjectId("61f8543d135b547f1f09a7ab"),
"nroAluno" : 81135573,
"nomeCurso" : "NULL"
}
----Validador para Matriculado------
{
$jsonSchema: {
required: [
'nroAluno',
'nomeCurso'
],
properties: {
nroAluno: {
bsonType: 'int',
description: 'must be a int and is required',
uniqueItems: true
},
nomeCurso: {
bsonType: 'string',
description: 'must be a string and is required',
uniqueItems: true
}
}
}
}
-----Tabela professor------
{
"_id" : ObjectId("61f85164135b547f1f09a7a6"),
"idProf" : 142519864,
"nomeProf" : "Ivana Teach",
"idDepto" : 20
}
{
"_id" : ObjectId("61f85164135b547f1f09a7a7"),
"idProf" : 242518965,
"nomeProf" : "James Smith",
"idDepto" : 25
}
----Validador para Professor------
{
$jsonSchema: {
required: [
'idProf',
'nomeProf',
'idDepto'
],
properties: {
idProf: {
bsonType: 'int',
description: 'must be a int and is required',
uniqueItems: true
},
nomeProf: {
bsonType: 'string',
description: 'must be a string and is required'
},
idDepto: {
bsonType: 'int',
description: 'must be a int and is required'
}
}
}
}

Você também pode gostar