mongodb查询出某个字段最大值

对字段进行降序排序,然后取出集合第一条数据

以下为 取出student集合stu_id字段的最大的一条:

db.student.find().sort({stu_id:-1}).skip(0).limit(1);

猜你喜欢

转载自blog.csdn.net/qq_28393323/article/details/80222030