我将Mongodb Native Driver For Node v2.1与0.12.X版本中的节点应用程序一起使用。 我刚刚将驱动程序升级到2.2版本,但是我通过简单的插入得到了这个错误:
/web-apps/j2ee/jenkins/back/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:320
self.s.pool = new Pool(Object.assign(self.s.options, options, {bson: this.s.
^
TypeError: undefined is not a function
at Server.connect (/web-apps/j2ee/jenkins/back/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:320:33)
at Server.connect (/web-apps/j2ee/jenkins/back/node_modules/mongodb/lib/server.js:328:17)
at open (/web-apps/j2ee/jenkins/back/node_modules/mongodb/lib/db.js:220:19)
at Db.open (/web-apps/j2ee/jenkins/back/node_modules/mongodb/lib/db.js:243:44)
at connectFunction (/web-apps/j2ee/jenkins/back/node_modules/mongodb/lib/mongo_client.js:220:67)
at connect (/web-apps/j2ee/jenkins/back/node_modules/mongodb/lib/mongo_client.js:367:5)
at Function.MongoClient.connect (/web-apps/j2ee/jenkins/back/node_modules/mongodb/lib/mongo_client.js:113:3)
at PriceInsert._write (/web-apps/j2ee/jenkins/back/src/helpers/price-insert-stream.js:34:21)
at doWrite (_stream_writable.js:301:12)
at writeOrBuffer (_stream_writable.js:288:5)
documentation for driver compatibility不是最新的,因为只有2.1版本的要求。它们似乎使用与节点0.12.X不兼容的ES2015功能(Object.assign)。
我必须留在第2.1节吗?
答案 0 :(得分:2)
我刚刚在他们的Jira跟踪器上发现了一个问题,这个bug将在下一个版本2.2.1修复。
https://jira.mongodb.org/browse/NODE-747?jql=project%20%3D%20NODE