如何将数据添加到邮递员

时间:2017-01-25 08:52:15

标签: javascript postman

如果我想在下面的架构中添加一些数据:

'use strict';

var mongoose = require('mongoose')
, Schema = mongoose.Schema;
var notificationsSchema = new mongoose.Schema({
    notifyMessage                   : { 
            title                       : { type: String },
            des                         : { type: String }
        },
        notifier                        : { type: String },
        recipient                       : [{
            id                          : { type: String },
            status                      : {type:String,trim:true,enum:['read','unread']}
        }]
});

module.exports = mongoose.model('notification_tracker', notificationsSchema);

我试过这种方式: enter image description here enter image description here

但它最终以这种方式结束..

2 个答案:

答案 0 :(得分:2)

选择原始单选按钮并确保将其设置为 JSON(application / json),然后粘贴或添加您的JSON对象

enter image description here

{
  notifyMessage: {
    title: "",
    des: ""
  },
  notifier: "",
  recipient: [{
    id: "",
    status:""
  }, {
    id: "",
    status:""
  }]
}

使用此格式

答案 1 :(得分:0)

我认为你可以选择" raw"选项而不是form-urlencoded,然后只是你把你的json代码:

    notifyMessage : { 
            title : something,
            des : something
        }}
...etc
相关问题