滕磊的个人网站
javascript css html mongodb typescript linux docker mysql 美文 经典语录 励志 句子摘抄 名人名言 座右铭
» 栏目 » mongoose教程 » mongoose排序查询sort方法

mongoose排序查询sort方法

栏目: mongoose教程 发布时间:2022-02-09

mongoose 使用 sort 方法进行排序。

  • mongoose 倒序排序

mongoose 按文章更新日期倒序排序实例:

Article.
  find({}).
  limit(10).
  sort({
    updatedTime: -1
  })
  • mongoose 正序排序

mongoose 按文章更新日期正序排序实例:

Article.
  find({}).
  limit(10).
  sort({
    updatedTime: 1
  })

本文地址:https://www.tides.cn/p_mongoose-sort

标签: sort mongoose sort

推荐阅读

Mongoose使用教程 mongoose or查询方法 mongoose查询文档教程 (node:43032) DeprecationWarning: Mongoose: findOneAndUpdate() and findOneAndDelete() without the useFindAndModify option set to false are deprecated. See: https://mongoosejs.com/docs/deprecations.html#findandmodify (Use node --trace-deprecation ... to show where the warning was created) mongoose and查询方法 mongoose删除列的方法 Executor error during find command: OperationFailed: Sort operation used more than the maximum 33554432 bytes of RAM. Add an index, or specify a smaller limit. $sample stage could not find a non-duplicate document after 100 while using a random cursor 如何使用 mongoose 对数组中数组中的元素进行查询? mongoose随机取n条数据 微信小程序在后台运行多久会被回收? Chrome浏览器插件从Manifest V2迁移到Manifest V3迁移指南

简体字繁体字转换工具 图片转base64编码 rgb转16进制 rgb颜色对照表 在线小工具 古诗词 古诗词问答

Copyright @tides.cn 苏ICP备20031417号-2