CastError: Cast to ObjectId failed for value "55263f72fa91f165119390" at path "_id"
at ObjectId.cast (/Users/Ethan-Wu/repository/github/jackfruit-server/node_modules/mongoose/lib/schema/objectid.js:117:13)
at ObjectId.castForQuery (/Users/Ethan-Wu/repository/github/jackfruit-server/node_modules/mongoose/lib/schema/objectid.js:166:17)
at Query.cast (/Users/Ethan-Wu/repository/github/jackfruit-server/node_modules/mongoose/lib/query.js:2340:32)
at Query.findOne (/Users/Ethan-Wu/repository/github/jackfruit-server/node_modules/mongoose/lib/query.js:1118:10)
正在使用两个div来显示数据,上面的代码不起作用。 任何帮助都被接受。
答案 0 :(得分:3)
作为@Zauberfisch stated here,您需要在模板中使用limit(4)
(注意小写)。
另一个问题是<%
和loop
之间缺少空格。
假设$ Video是某种SS_List
(ArrayList或DataList),你可以试试
//show the first 4 videos
<% loop $Video.limit(4) %>$Title <% end_loop %>
//gets the next 9 videos, offset is 5
<% loop $Video.limit(9,5) %>$Title <% end_loop %>