Why should I use + in mongoDB request

I study learnyoumongo tutorials to learn mongoDB.

In the third exercise ( find ), I could not get it to work until I found a solution. My mistake was that the request needed a “+” before the argument.

therefore db.coll.find({ $gt: process.argv[2] })does not work, but { $gt: +process.argv[2] }did.

This may be a stupid question, but what is the plus sign, and when will I use it?

Also does it play a role in regular javascript?

+4
source share
1 answer

+ . process.argv[2] . + - , . $gt , - .

+6

Source: https://habr.com/ru/post/1598780/


All Articles