It's more like a theoretical questions than an actual issue but I hope somebody have time to answer it:
Suppose that you have this definition at the beginning of a node.js file:
const ObjectId = mongoose.Types.ObjectId;
Which one do you prefer and why?
// 1
new ObjectId;
// 2
new ObjectId();
// 3
ObjectId();
The official document suggests to use new ObjectId
(#1), for me new ObjectId()
(#2) feel more natural but each of them generates a new ObjectId and I have seen examples for each of them in SO's questions and answers.
via Festo
No comments:
Post a Comment