出现以下错误时:
G:
odejslogin
ode_modulesmongodblibmongo_client.js:797
throw err;
^
TypeError: db.collection is not a function
at findRestaurants (G:
odejsloginapp.js:22:19)
at G:
odejsloginapp.js:35:3
at args.push (G:
odejslogin
ode_modulesmongodblibutils.js:404:72)
at G:
odejslogin
ode_modulesmongodblibmongo_client.js:255:5
at connectCallback (G:
odejslogin
ode_modulesmongodblibmongo_client.js:933:5)
at G:
odejslogin
ode_modulesmongodblibmongo_client.js:794:11
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
解决方案:
项目包的package.json文件中,将以下依赖项中的“mongodb”的值修改为以下值即可(“^2.2.33”)
并重新再目录下执行 npm install语句