mongodb文章表字段_idtitlecontentdate(时间戳)如何查询文章按年份归档这样的列表(刚接触mongodb)20172017-01-3文章标题2017-01-3文章标题20162016-01-3文章标题2016-01-3文章标题
2 回答
胡子哥哥
TA贡献1825条经验 获得超6个赞
我现在正在弄这个,你可以参考下我的,我是这样解决的,这里我是采用的ejs模块,如过你也是采用这个模块引擎的话,这样写是可以的。 <%varlastDay=0%><%posts.forEach(function(post,index){%><%if(lastDay!=post.time.day){%><%=post.time.day%>
<%lastDay=post.time.day%><%}%>"><%=post.name%> 发表的 /<%=post.time.day%>/<%=post.title%>"><%=post.title%> <%})%>
添加回答
举报
0/150
提交
取消
