Q:

Sending JSON obj fields in Insomnia

I'm trying to send a JSON object inside one of the fields I have, in order to store it in the MongoDB (Using Mongoose Schema). Right now I'm facing a server-sided JSON parsing error. 
This is what I'm trying to send
{
"text":"N1y",
"localId":"123",
"type": "media",
"attachments": {
url:"Test.jpg",
publicId:"123"
}
}

My Moongose Schema
const messageSchema = mongoose.Schema({
  createdAt: {
    type: String,
    default: new Date()
  },
  chatId: {
    type: String,
    required: true
  },
  localId: {
    type: String,
    required: true
  },
  text: {
    type: String,
    required: true
  },
  authorId: {
    type: String,
    required: true
  },
  type: {
    type: String,
    default: 'text'
  },
  attachments: {},
  style: {
    type: String,
    default: 'normal'
  }

Using Node.JS with Express.

A:

In the schema update attachments type to object and request object in not correct json.
{
    "text": "N1y",
    "localId": "123",
    "type": "media",
    "attachments": {
        "url": "Test.jpg",
        "publicId": "123"
    }
}
Schema
attachments: {
  type : Object
},

OR
attachments: {
    url: {
        type: String
    },
    publicId: {
        type: String
    },
}

