2017-01-25 25 views
4

にデータを追加する方法を、私は下の私のスキーマにいくつかのデータを追加したい場合は、次の郵便配達

'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

をしかし、それはこのように終わりました。

+0

生データとしてJSON形式で送信してください。ラジオボタン「生」を選択します。受信者用 – Ninjaneer

答えて

1

ラジオボタンを選択し、これを使用して、この

enter image description here

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

のようなあなたのJSONオブジェクトを貼り付けたり、追加しとしてJSON(アプリケーション/ JSON)それを設定してください形式

+0

? –

+0

同じこと、notifyMessageの後に別のオブジェクトを追加することができます。 – prtdomingo

+0

@swatikiran私は自分の答えを更新しました。私が追加したフォーマットを使用し、あなたが望む値に応じてそれを更新するだけです – prtdomingo

0

"raw"オプションを選択でき、form-urlencodedではなく、jsonコードを入力するといいと思います。

notifyMessage : { 
      title : something, 
      des : something 
     }} 
...etc 
関連する問題