#Node.js script connected to MongoDB wont return anything in the cmd when ran
23 messages · Page 1 of 1 (latest)
You know what "return" means?
And you know what "insert" means?
If so, you can answer your question alone with that info xD
Kind of weird that nothing gets printed tho
Have you seen the order?
imo, they never reach their console.log
Because they added a function in the write concern part of mongodb.
i dont think that will run as intended.
Also, how do they have access inside that function to the db object? when its before defined as dbo or parent class db.db
oh lol
no idea what the order of arguments is, I just assumed you can pass a callback that gets called for each insertion or something 💀
i also didnt see at first, so my thought was insert != fetch xD
db.collection.insertOne(
<document>,
{
writeConcern: <document>
}
)
from mongo api
(tbh ive no real idea what the write concern part is, but it doesnt look like a function param xD)
write concern is for replica sets, basically telling Mongo how many confirmations you need
im so sorry guys, yesterday was just a long day and it was my first time working with mongodb so i was just super drained
but yeah i think the video my uni gave me was kinda outdated so literally nothing worked
That might be the actual reason tbf
Because the code looked okay assuming that Mongo does the stuff with callbacks instead of just sync/async
I used mongoDBs code in their website and it worked first try
yep
turns out sleeping does solve problems
jkjk
thank you guys genuinely
i probably wouldnt have stopped to check mongodbs actual code if it werent for yall🫡🫡
No worries, we all know that xD
Imagine you read a error message, understand it, but search somewhere else for the error for hours... then go step by step, read each error message aloud for better understanding and then... fuck... that stood tehre from the start... changed one small line and all working xD
LIke the daily rountine of a software dev^^