question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bugs during update from 4.7.2 to 4.7.3

See original GitHub issue

Hello,

Yesterday after update the mongoose to 4.7.3 i hava some trouble with β€œall” tests in my application All tests returns me: Validation Errors, and Cast errors, TypeError: Cannot read property β€˜remove’ of undefined;

Sample error:

 CastError: Cast to ObjectId failed for value "586b672be11a4670c4eb3f66" at path "_id" for model "User"
      at MongooseError.CastError (/common/node_modules/mongoose/lib/error/cast.js:26:11)
      at ObjectId.cast (/common/node_modules/mongoose/lib/schema/objectid.js:147:13)
      at ObjectId.castForQuery (/common/node_modules/mongoose/lib/schema/objectid.js:187:15)
      at cast (/common/node_modules/mongoose/lib/cast.js:229:32)
      at Query.cast (/common/node_modules/mongoose/lib/query.js:2752:12)
      at Query.findOne (/common/node_modules/mongoose/lib/query.js:1353:10)
      at /common/node_modules/mongoose/lib/query.js:2310:21
      at Query.exec (/common/node_modules/mongoose/lib/query.js:2304:17)
      at Query.then (/common/node_modules/mongoose/lib/query.js:2351:15)
      at next (/common/node_modules/co/index.js:100:51)
      at onFulfilled (/common/node_modules/co/index.js:69:7)
      at /common/node_modules/co/index.js:54:5
      at co (/common/node_modules/co/index.js:50:10)
      at Test.<anonymous> (src/routes/me.spec.js:169:11)
      at Test.assert (/common/node_modules/supertest/lib/test.js:156:6)
      at Server.assert (/common/node_modules/supertest/lib/test.js:127:12)
      at emitCloseNT (net.js:1537:8)

Let me know what more informations you know.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:8
  • Comments:22 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
JvrBaenacommented, Jan 3, 2017

Hi @vkarpov15 We have performed some tests locally and have seen that in this line https://github.com/Automattic/mongoose/blob/master/lib/schema/objectid.js#L147 …the error that is being catched and transformed into a CastError is this:

[TypeError: hex is not a function]

We have tried tracking this through the dependencies, and if we got this right, this goes all the way down to the bson package which happens to have been updated 19h ago (https://www.npmjs.com/package/bson) and seems to involve some validation changes in the ObjectId type (https://github.com/mongodb/js-bson/commit/e136ac084a8a3db135a9e36efa157f517b5336e4)

… bson is listed in mongoose’s package.json with ~1.0.1 and the latest version is 1.0.2.

In my local environment, where I can reproduce this, bson has been updated to the 1.0.2 as a dependency of mongodb-core.

β”œβ”€β”¬ mongoose@4.7.4
β”‚ β”œβ”€β”¬ async@2.1.4
β”‚ β”‚ └── lodash@4.17.4
β”‚ β”œβ”€β”€ bson@0.5.7
β”‚ β”œβ”€β”€ hooks-fixed@1.2.0
β”‚ β”œβ”€β”€ kareem@1.1.5
β”‚ β”œβ”€β”¬ mongodb@2.2.16
β”‚ β”‚ β”œβ”€β”€ es6-promise@3.2.1
β”‚ β”‚ β”œβ”€β”¬ mongodb-core@2.1.2
β”‚ β”‚ β”‚ β”œβ”€β”€ bson@1.0.2
β”‚ β”‚ β”‚ └─┬ require_optional@1.0.0
β”‚ β”‚ β”‚   └── resolve-from@2.0.0
β”‚ β”‚ └─┬ readable-stream@2.1.5
β”‚ β”‚   └── isarray@1.0.0
4reactions
ifyourcommented, Jan 4, 2017

Found a temporary solution:

npm install mongoose@4.7.2
Read more comments on GitHub >

github_iconTop Results From Across the Web

December 13, 2022-Security and Quality Rollup for .NET ...
NET Framework 3.5, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8 for Windows Server ... This security update addresses a vulnerability where restricted mode ...
Read more >
Fix The .NET Framework 4.7.2 is not supported on ... - YouTube
Today i get the following one error notification while i try to installing the microsoft net framework :Microsoft.
Read more >
BaseCamp Updates & Downloads - Garmin
Various stability and bug fixes. Changes made from version 4.7.1 to 4.7.2: Fixed routing mismatch issue on Zumo XT; Fixed map display issue...
Read more >
4.7. Red Hat Virtualization 4.3 Batch Update 6 (ovirt-4.3.9)
4.7.1. Bug Fix Β· 4.7.2. Enhancements Β· 4.7.3. Known Issues.
Read more >
Changelogs for 4.7.X β€” PowerDNS Recursor documentation
Bug FixesΒΆ Β· Fix compilation of the event ports multiplexer. Β· Correct skip record condition in processRecords. Β· Also consider recursive forwardΒ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found