All Questions
39 questions
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 ...
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 ...
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 ...
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:
...
3
votes
0
answers
89
views
Clean code: Permission with middleware
In my example, I have four models: User, Company, Project, and Plant (though my project technically has more: Plant, Job, Team, etc.).
...
8
votes
5
answers
629
views
Checks user level and limit the data before saving it to mongoDB
I have a function that checks user level and limits the data before saving it to mongoDB database (pre 'save' middleware for mongoose).
It have been getting complexity warnings and tried to rewrite it,...
3
votes
3
answers
392
views
Upload .JSON product list to MongoDB and upload image to AWS S3
I'm using Node/Express/Mongoose to accept a JSON file containing a list of product details. These products are looped through, the images are uploaded to AWS S3, and the product is either accepted or ...
0
votes
1
answer
65
views
MongoDB database connector on NodeJS
What my code does
I am building an Express API server with mongoDB as my database.
I have a list of players which must be added to 2 mongoDB collections (teamList and countryList).
The data schema ...
4
votes
1
answer
120
views
Mongoose schema to store items from Wynncraft's API
I am making a Schema to store items from Wynncraft's API.
See an example assortment of items here:
https://api.wynncraft.com/public_api.php?action=itemDB&search=a
I have not finished making the ...
1
vote
1
answer
57
views
Creating Mongoose model
I'm creating a Mongoose model for a web service. I have a secondary index on facultyId because majority of the reads would want to search by ...
2
votes
0
answers
45
views
Javascript RPC Call Handles Data and Returns DB Response
I have a service within a larger set of microservices that's handling a RPC call. My function mainly just parses through the request, uses the data to insert data into our MongoDB database, and then ...
0
votes
1
answer
43
views
Send Response To Browser without DB save confirmation
Just reviewing my own code and noticed that I'm saving info in the DB and WAITING for that to respond before I send info to the browser, although I'm wondering if it would be more performant to not ...
2
votes
1
answer
109
views
Session generator/checker utility for a server
I wrote a utility for generating and saving sessions in a MongoDB database as well as checking the session to make sure it's valid.
I'm a beginner when it comes to promises and I have a feeling that ...