开发者社区 问答 正文

MongoDB中如何排序显示

如何让下面的内容,按comments.time时间倒序排列呢?
1
试图使用:db.comments.find().sort({"comments.time":-1});
但是毫无效果?请各位帮忙解答下!

展开
收起
落地花开啦 2016-02-22 16:20:08 2467 分享 版权
1 条回答
写回答
取消 提交回答
  • 喜欢技术,喜欢努力的人

    修改db.comments.find().sort({time:-1}).limit(100).explain()

    2019-07-17 18:46:49
    赞同 展开评论