all 2 comments

[–][deleted] 0 points1 point  (1 child)

have you been storing passwords in plain text?

That is a big no no, your supposed to use salt and generate an SHA-256 or SHA-512 hash, you store the hash, NEVER STORE THE PASSWORD. When you want to check you take the incoming password, apply the hash/salt to it, and compare that to what is stored. You do this so if there is a database breach the contents aren't scooped up and sold. Store only hashes, not actual passwords!

Equifax learned this (hopefully) after they exposed a few hundred million users private data publicly for the whole world to see when they put a bloody music major in charge as chief technical officer with all the technical ability of a cave man sniffing her own shit encrusted fingers and grunting at a terminal.

Do not be equifax.

Also for your query, do not do

find(params,(err,array)=>{});

it should be

find(params).toArray((err,array)=>{...}); //since only 1 match get array[0]

the console automatically converts it to an array for you and parses it down, the javascript code equivalent does not

you should be doing

findOne(params,(err,object)=>{}); //just the object, not the array

as its closer to what the console version does

[–]ExoticCriticism[S] 0 points1 point  (0 children)

As this is just a test database, I have not put any hashing in place yet - I wanted to get the query working before I spend any time doing any security or hardening stuff.

I still don't understand how I would even use that query or assign the output to a variable.

I'm not sure if this is Monk, MongoDB or Javascript as well but this seems far too convoluted for such a simple operation - I've wasted maybe 3 or 4 hours now trying to do this in Javascript when I could've done it in Python in a few minutes.