我有这个json:
{
"data": [
"id": "1",
"name": "Sample test",
"description": "this is a sample test",
"category": "tests",
"points": 100,
"startDate"?:?"2018-02-15 00:00:00"?,
"endDate"?:?"2018-02-22 00:00:00"?,
"isActive"?:?true?,
"alreadyAnswered"?:?false?,
"questions"?:[
{
"id": 1,
"text": "What is your name",
"type": "text",
},
{
"id": 2,
"text": "What is your favorite color",
"type": "select",
"options": [
{
"id": 1,
"text": "Red",
"value": "red"
},
{
"id": 2,
"text": "Blue",
"value": "blue"
}
]
}
]
]
}
Run Code Online (Sandbox Code Playgroud)
我需要将此json创建到mongo数据库中,以便可以通过节点应用程序获取它。
这是我当前的模式:
let TestSchema = new Schema({
id: Number, …Run Code Online (Sandbox Code Playgroud)