Is it possible in Sailsjs to build more complex models

前端 未结 2 1500
陌清茗
陌清茗 2021-02-14 11:21

I would like to have arrays or collections in my model, is this yet possible with waterline (mongoDB)? are there any alternatives around?

example:

{
   n         


        
2条回答
  •  终归单人心
    2021-02-14 11:52

    If you're looking for model associations, it's not there yet (look at this issue for proposed implementations) if you'd just like to have arrays of data stored in DB, you can have arrays as attribute (see the doc for reference on that). I haven't tested it but I guess it will serialize the array prior to saving it in the DB if it doesn't have a matching structure.

提交回复
热议问题