无法读取未定义的 属性 'ObjectID'
Cannot read property 'ObjectID' of undefined
我正在分叉/尝试理解 mongodb-rest 项目。当我 运行 只有 rest.js
脚本时,我得到这个错误:
TypeError: Cannot read property 'ObjectID' of undefined
at app.post.connection.connect.res.status.json.message (/var/lib/openshift/5556b4c4fcf9336abf0000de/app-root/runtime/repo/server.js:99:32)
在这一行,当我尝试处理 PUT
消息时:
var spec = {'_id': new BSON.ObjectID(req.params.id)};
我有与 rest.js
相同的 'include' 行
var mongodb = require("mongodb");
var BSON = mongodb.BSONPure;
但 运行 在 OpenShift
个服务器上。
知道哪里出了问题吗?
更新
我尝试使用相同的包:
var bson = require("bson");
var BSON = bson.BSONPure.BSON;
//var BSON = mongodb.BSONPure;
遇到同样的错误
尝试使用 bson 包而不是 mongodb:
var BSON = require('bson').BSONPure
我正在分叉/尝试理解 mongodb-rest 项目。当我 运行 只有 rest.js
脚本时,我得到这个错误:
TypeError: Cannot read property 'ObjectID' of undefined
at app.post.connection.connect.res.status.json.message (/var/lib/openshift/5556b4c4fcf9336abf0000de/app-root/runtime/repo/server.js:99:32)
在这一行,当我尝试处理 PUT
消息时:
var spec = {'_id': new BSON.ObjectID(req.params.id)};
我有与 rest.js
var mongodb = require("mongodb");
var BSON = mongodb.BSONPure;
但 运行 在 OpenShift
个服务器上。
知道哪里出了问题吗?
更新
我尝试使用相同的包:
var bson = require("bson");
var BSON = bson.BSONPure.BSON;
//var BSON = mongodb.BSONPure;
遇到同样的错误
尝试使用 bson 包而不是 mongodb:
var BSON = require('bson').BSONPure