TypeError: Unknown encoding: 1
at Buffer.slowToString (buffer.js:487:17)
at Buffer.toString (buffer.js:500:27)
at ObjectID.toString (/node_modules/mongoose/node_modules/bson/lib/bson/objectid.js:174:20)
at formatValue (util.js:352:36)
at formatProperty (util.js:794:15)
at util.js:654:12
at Array.map (native)
at formatObject (util.js:653:15)
at formatValue (util.js:592:16)
at formatValue (util.js:358:17)
at inspect (util.js:186:10)
at exports.format (util.js:72:24)
.....
at nextTask (/node_modules/async/dist/async.js:5070:14)
at /node_modules/async/dist/async.js:5064:13
at apply (/node_modules/async/dist/async.js:21:25)
at /node_modules/async/dist/async.js:56:12
at /node_modules/async/dist/async.js:840:16
...
at /node_modules/mongoose/lib/query.js:2323:18
at process._tickDomainCallback (internal/process/next_tick.js:129:7)
NodeJS - 7.3.0
Mongoose - 4.7.6
@ypanyukov there was a bug introduced in bson 1.0.2 on January 2, which was fixed a couple of hours ago in 1.0.3 https://github.com/mongodb/js-bson/commit/35f5264446fb74e475ecf25f94ce7b177b5b35fd
Chances are you have bson 1.0.2 installed now (verify with npm list bson
).
Re-intstall all deps, verify that bson is 1.0.3 and see if it works now.
Working with:
[email protected]
[email protected]
[email protected]
Is it possible that this can be made a requirement for mongoose (^1.0.3
)? This was a really hard issue to come by and fix - it would be nice to have it magically taken care of with a mongoose upgrade.
@harangue updating to the latest mongo and mongoose had this "magically taken care of" :)
Tbh the best solution would just be to deprecate bson 1.0.2 . mongoose needs to have the same package.json entry for bson as mongodb-core to avoid potential conflicts
Most helpful comment
@ypanyukov there was a bug introduced in bson 1.0.2 on January 2, which was fixed a couple of hours ago in 1.0.3 https://github.com/mongodb/js-bson/commit/35f5264446fb74e475ecf25f94ce7b177b5b35fd
Chances are you have bson 1.0.2 installed now (verify with
npm list bson
).Re-intstall all deps, verify that bson is 1.0.3 and see if it works now.