-
Type: Improvement
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: 5.0.0
-
Component/s: None
What problem are you facing?
When upgrading to the MongoDB Node 5.0 driver, all calls to `ObjectId()` without `new` result in the following error:
```
Class constructor ObjectId cannot be invoked without 'new'
```
I couldn't find this breaking change documented anywhere, so I wasn't sure if it was actually intentional. I don't know if this was formally supported, but it's relatively common use. For example, this StackOverflow answer discusses them being equivalent and the console docs provide examples of constructing them without the keyword (I recognize that parity with the console is not guaranteed, but my understanding is that it is generally aimed for). Here's an example case of someone running into this in the community.
If this is actually intended and I missed the change notice this could be closed. If it was intended but was not documented perhaps it could be mentioned in the upgrade guide. If it was not intended then this can serve as a bug report.
Thanks!
What driver and relevant dependency versions are you using?
mongodb 5.0.1 driver
Steps to reproduce?
```
import { ObjectId } from 'mongodb'
const x = ObjectId()
```