I am forking / try to understand mongodb-rest project. When I am running only the rest.js
script I get this error:
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)
at this line, when I try to handle PUT
message:
var spec = {'_id': new BSON.ObjectID(req.params.id)};
I have the same 'include' lines as rest.js
var mongodb = require("mongodb");
var BSON = mongodb.BSONPure;
but running on OpenShift
servers.
Any idea what is wrong?
I tried to use same package:
var bson = require("bson");
var BSON = bson.BSONPure.BSON;
//var BSON = mongodb.BSONPure;
got same error
Try using the bson package instead of mongodb:
var BSON = require('bson').BSONPure
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With