TypeError:db.findWConditionandler不是MongoDB函数 [英] TypeError: db.findWConditionandler is not a function MongoDB

查看:63
本文介绍了TypeError:db.findWConditionandler不是MongoDB函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这实际上是我上一个问题的延续,我感到很疑惑,因为我意识到自己并没有问这个问题,而现在我有一个不同的错误响应.

This is actually a continuation of my previous question and I'm reasking as I've realised I didn't quite ask the question problem and now I have a different error response.

这是在db.js中,这是我拥有处理程序时的单独文件. 上下文:我这样返回func,以便在我的index.js中,我可以继续执行mongodb sort操作来查找时间戳最小的用户!

This is in db.js, a separate file while I have the handlers. Context: I return func like this so that in my index.js, I can continue to perform mongodb sort operation to find users with the smallest timestamp!

在服务器控制台中,我收到此响应.TypeError: db.findWConditionandler is not a function我不确定我在做什么错.请咨询!提前致谢!

In my server console, I get this response.TypeError: db.findWConditionandler is not a function I'm not sure what I'm doing wrong here. Pls advice! Thanks in advance!

推荐答案

问题是因为.sort需要光标,而.findOne()没有给出光标.相反,应该使用.find()

The problem is because .sort expects a cursor and .findOne() doesn't not give a cursor. Instead, one should use .find()

这篇关于TypeError:db.findWConditionandler不是MongoDB函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆