Sunday, 30 April 2017

mongoose schema for a dictioanary

{
"_id" : ObjectId("5905d84ea1b895165b28a2d6"),
"name" : "risk",
"email" : "hyuji@gmail.com",
"cgpa" : "9",
"stream" : "uio",
"password" : "password",
"registered" : [ "reg1", "reg2"],
"color" : {"reg1":1,
         "reg2":2}

}

This is how my database looks, Now i need to write a schema for it

var studentDataSchema = new Schema({
name : String,
email : String,
cgpa : Number,
stream : String,
password : String,
registered : [],
color : {}

});

How to declare color in above schema, is it correct ??



via harish chava

No comments:

Post a Comment