Node JS "let" command questions / quirks


Will someone please point me to the Mongo documentation for the “let” command?

Seems to be used to execute a dB call to set a cursor like “let result = await companiesCollection.updateOne(documentToUpdate, updateEmployees)”

Seems to be used to set a variable value: let documentToUpdate = {“name”:“Zvents”}
However, the “const” command is also used to set a variable value:
const update = { $inc: { balance: 100 }}
Why have two ways to do the same thing?



Not 2, but 3.

Using let, vs const vs var has absolutely nothing to do with MongoDB.

They are pure JavaScript concepts.

You may start with

  1. let - JavaScript | MDN,
  2. const - JavaScript | MDN
  3. and var - JavaScript | MDN

Thanks Steeve. Oh, so let, const and var are JavaScript concepts. Thanks for the links!

I don’t see a way to close out this post. How do I close it?

Since you started the thread the three little dots should provide you with a solution button.

i got that option to close in a current posting, but not on these older ones.

Thanks for trying.

Hopefully someone with admin rights will take care of it.