-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.5.9
-
Component/s: None
-
Labels:
-
Environment:Ubuntu 18.04
-
Empty show more show less
I'm trying to use bcrypt for passwords in Nodejs. Values I get are added to the DB correctly with the insertOne function for new collection entries. I can modify a field with the code below as long as the value for cryptPass doesn't have a $. So the commented string would be replaced correctly with the given code sample, while the one set in the example doesn't. Pass gets set to an empty value instead. The documentation doesn't say anything about alternative for setting values with $. If this is not a bug. Please provide details about how to proceed with $set string values that have $ in the documentation. I was looking around to see if there $ needs to be escaped, also didn't find anything.
//let cryptPass = '2a12Ez4snVWhyWbM5ozNxSqvCONuELToqb6xxj5PYpZtap3zT5QQ8mya'
let cryptPass = '$2a12Ez4snVWhyWbM5ozNxSqvCONuELToqb6xxj5PYpZtap3zT5QQ8mya'
return db.collection(collectionName).updateOne(
{_id: user._id},
[{$set: {
pass: cryptPass
}}]
)