i doing learnyoumongo tutorials learn mongodb.
on third excercise (the find tutorial) couldn't work until found solution. mistake query needed "+" in front of argument.
so db.coll.find({ $gt: process.argv[2] }) did not work, { $gt: +process.argv[2] } did.
perhaps stupid question, plus sign, , when use it?
also play role in regular javascript?
the + in context implicit cast number. process.argv[2] string. + quick, easy, , safe way cast number. $gt expects number comparison rather string -- numeric string.
Comments
Post a Comment