All Questions
62 questions
1
vote
1
answer
93
views
Optimising a simple graphql mutation resolver
I am writing a resolver for a typical updateUser mutation with node, Apollo Server and mongoDB. I want to make it such that, when the ...
2
votes
1
answer
115
views
Basic node login routes for authentication system
I am building a basic authentication system with a node backend and wonder whether I am using the try-catch block excessively. I have this example controller:
...
0
votes
1
answer
658
views
Import XML files to MongoDb with Nodejs
Here is my code which will read XML files and import the data to MongoDb. Do you have any comments on my code?
...
2
votes
1
answer
392
views
MongoDB Filter between two dates
Simple code for getting documents that have a creationDate between two values in mongodb.
If the user provides only one of the values the code should still work and ...
1
vote
1
answer
156
views
Basic REST API for manipularing a MongoDB collection, using Node, Express, and Mongoose
I'm practicing back-end programming and NodeJS. As an exercise, I'm attempting to build a REST API for a MongoDB collection. I'm also learning to use the Express and Mongoose middle-wares, so that's ...
2
votes
1
answer
123
views
Is this nodejs web-application spaghetti code?
I recently interviewed for a backend developer role at a startup involved in financial products, as a 2020 grad. The take-home assignment they had me submit had a few basic goals and they recommended ...
6
votes
1
answer
74
views
creating accounts with passportJs
I'm currently building an application using Passport and bcrypt for user authentication. I've created the registration part. Is there anything I could improve on? I'm still getting the hang of writing ...
4
votes
1
answer
5k
views
"Clean Architecture" design pattern with Node.JS and MongoDB
After some time poorly designing my web applications' backends (mixing database calls with the controller, etc.), I have decided to try the "Clean Architecture" approach.
In this example I have a ...
4
votes
3
answers
195
views
Find events associated with users on a certain date in MongoDB
I have this script which works perfectly but I experienced some delays because of these 2 for loops [i][j]. Is there any way to ...
2
votes
0
answers
114
views
Modeling mongoose schemas
I'm in the process of creating my first web app using node with mongodb on the backend. I could use some opinions on the schemas/models I've set up.
I have three schemas: User, Pet, Food. Here's the ...
3
votes
0
answers
420
views
Mern stack app on error handling, async await, try-catch and avoiding DRY in controller functions
I'm looking for a review of my backend code on how to keep it more DRY. I see a lot of repetition in validation part of email and password, also I need some advice on if I have used the try-catch and ...
2
votes
0
answers
121
views
Process data from mongodb and upload result to S3
I'm working on an AWS lambda function that take data from two mongodb databases, find the matching records between two collections by 'id' and calculate each record commission by fixed rate. Then ...
2
votes
0
answers
115
views
Writing error handling and users routing for my JSON RESTful API
I'm currently making an app for my side project and I was looking to get some insight on the main js file, what can I improve, the error handling, what am I doing wrong, etc. I'm mostly confused about ...
4
votes
0
answers
414
views
MongoDB BulkWrite - create or update a sub document within an array
I have a series of Events (roughly 10-20 events that will be dynamically created per month):
Event Model:
...
4
votes
1
answer
699
views
Enhancing search using Fuzzy Logic in NodeJS
Brief Description:
In my NodeJS Application, I have a model called User.
User.js
...