Just a grain of sand
2 min readJul 20, 2024

--

First of all - I get your frustration and rust has a huge learning curve - at least for someone coming from JS/Typescript. Keep going my friend - trust me it will help you on the long run. Lots of us had been there. It really sucks and you feel at some point unproductive - that frustrates a lot.

1 . Your mongodb error comes from an concurrent write on an document. Mongo disallows that. May might be confusing. Had the same issue once. Your logging sucks I guess.

2. You can write this kind of unreadable code basically in any typed language. I don't want to call it a skill-issue. It`s often simplicity vs. complexity. Some coders love the one, some the other. I admire simplicity so I kind of understand why you got frustrated. I saw way worse code in Typescript and Typescript allows you to trick the compiler. That`s one thing people coming from Typescript to rust do not really understand. You can't trick the compiler that easy as they are used to do ;-) And that has tons of reason, because rust runs native machine code and has no background GC and Typescript will be interpreted as JavaScript at runtime - so reducing the language on syntax level is none sense.

3. You can use mongodb like any other database. Do not use the update method to make changes in concurrent environments. Choose insert over overwrite. Trust me it will change everything and makes your live tons easier. Data mutation in threaded environments is always pain. Rust is not your enemy here - trust me!

4. Mongodb is a great database! Use the right tool for the right job! In most cases you are better off with the classic SQL-Databases - trust me!

Take some days off or work on an other project. Come back. Rethink things, breathe a lot and just never give up! learning!!!!!

--

--

Just a grain of sand

My heart beats for bytes. Blogger, father, coach, trainer, consultant.