How to pass object as a data type to a data model in sequilize?

后端 未结 1 512
庸人自扰
庸人自扰 2021-01-26 06:07

I need to pass something that is not a primitive to the data type.

I am constructing something like this to send to the create method:

const p2 = {
            


        
1条回答
  •  暖寄归人
    2021-01-26 06:58

    The type you provide in the model are the types defined in the database you use. If you are using postgresql, you can use DataTypes.JSON as the type.

    If not, to save object, you can JSON.stringify the object and pass it as a string.

    0 讨论(0)
提交回复
热议问题