Storing Json Object in Mongoose String key

前端 未结 5 844
温柔的废话
温柔的废话 2021-01-30 04:14

In my Mongoose schema, I have a field which is a String, and I want to be able to store an JSON object in it. Is it possible? In Postgres, it\'s possible to store a dictionary i

5条回答
  •  星月不相逢
    2021-01-30 04:55

    if you can change the type of your field form "String" to "Object" you can save the json as it is.

    var schema_obj = new Schema({
    field1: Object,
    ..
    });
    

提交回复
热议问题