TypeError: db.findWConditionandler is not a function MongoDB

扶醉桌前 提交于 2020-05-09 17:13:09

问题


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.

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!

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!


回答1:


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



来源:https://stackoverflow.com/questions/61291191/typeerror-db-findwconditionandler-is-not-a-function-mongodb

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!