Skip to content
Advertisement

Tag: mongodb

findOne not working? mongoose / mongodb server

basically a user has properties {_id: objectid, username: string, password: string, .. etc} I send this route a json like below to change its username Assume Admin123 doesn’t exist then const foundUser would not be null because there is no user in the user collection with username Admin123. However const foundUser is never null? I’m not sure what I am

Weird output “<Buffer" in child_process.spawn

Trying to write a script to dump my MongoDB to afterwards restore it in a Test database again. Weirdly the script does what it is supposed to (I can find the output BSON under the specified location), but the output is cryptic: Answer That output is just encoded text. Try this to see the real output: Note that this output

How to update user data in MongoDB using node.js

I have a simple express app with MongoDB connection where I can register a user. Registering and logging in and out works fine but now I’m trying to add possibility to edit user data. My code doesn’t throw any errors but it doesn’t update the data in database neither. I’ve tried to read the MongoDB documentation and similar problems from

Advertisement