[英]How to include and order an array using the Strongloop Loopback REST API?
我通過在名為 User/Questions 的模型中添加術語{"include" : ["answers"]}
在現有模型中包含一個數組。 因此,如果我得到用戶/問題模型,我將得到一個答案列表。 但是,現在我想根據 dateCreated 在我的問題模型中對答案進行排序。 為此,我應該如何編輯放置在 REST Strongloop API 過濾器中的術語?
//QuestionModel
[
{
"question": "where is the coffee shop?"
"answers": [
//answer model included
{
"answer": "I am not sure",
"dateCreated": 4/1/16,
},
{
"answer": "maybe try 5th avenue?",
"dateCreated": 4/3/16,
},
{
"answer": "oh its by the bakery",
"dateCreated": 4/2/16,
}
]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.