Questions tagged [mongodb]

MongoDB is a scalable, high-performance, open source, document-oriented database. It supports a large number of languages and application development platforms.

Filter by
Sorted by
Tagged with
1
vote
1answer
36 views

Archiving MongoDB data to S3, with retryable steps

I have a python script to archive some data (export from mongo to a local json file and then upload it to s3) Is there a better way to implement/improve the current flow? Each step should be be ...
2
votes
2answers
50 views

Blog API implementation in node.js

This code is from my blog project. This project is almost done. This is working well. I can create new posts and update and display all saved posts. ...
0
votes
0answers
15 views

nested drop down for blog posts

I wrote this component to be a drop down for blog posts. The index prop is a PostIndex object returned from a query in the ...
0
votes
0answers
28 views

Tracking product prices

I'm using a web crawler/scrapper to keep tracking of products prices change. The bot fetches products' data and extracts needed info in this form: ...
3
votes
2answers
87 views

Spring Boot API - Avoiding Concurrency issues

I'm still in the process of learning Java / spring and I think I'm getting better. Now at this point I'm able to build a rest api BUT I'm at a lost at how to ensure I've no concurrency issues . I've ...
1
vote
0answers
12 views

Python/Mongo - Generating dummy data

I wrote below piece of code generating dummy data loaded to MongoDB. 2 issues : 1.customer class has subscriber class so it nested with one level customer--> subsciber. I think i'm not doing right: ...
0
votes
1answer
111 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? ...
4
votes
1answer
73 views

Commands Object creation using chained Builder pattern

Context As many of you may know I have a library that allows C++ objects to be converted into JSON/YAML/BSON automatically with a single declaration (see previous code reviews). I am now (trying) ...
2
votes
1answer
41 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
0answers
225 views

NextJS API endpoint for a 'form backend' service

(This is using NextJs but there was no tag for that available) I'm building a form backend service, similar to Formspree. The user can create a form however they like on their frontend and submit it ...
3
votes
0answers
92 views

Migrate customer and transaction data from CSV to MongoDB

I wrote a Java Spring Boot application with MongoDB that on every application start loads customer, account type and transaction details from CSV files to MongoDB. It has one end point that returns ...
5
votes
1answer
138 views

Express.js blogging application

I have put together a blogging application with Express, EJS and MongoDB. There is a public, front-end part and a dashboard. In index.js I have: ...
2
votes
0answers
322 views

mongodb RESTfull api in python using fastapi and mongoengine

So I wrote a a RESTfull api for a mongodb with python3.7, fastapi and mongoengine and id love to get feedback on how I should make my code more readable, clean, and dry. basically there are 4 main ...
1
vote
1answer
132 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
1answer
81 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
1answer
55 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 ...
2
votes
0answers
182 views

Simple Flask REST API to a MongoDB

I'm writing a simple REST API to my MongoDB using PyMongo (Python 3.7). Each collection I have in the DB has a route (e.g http://the.api.url/collection_name ), and every document under that collection ...
3
votes
1answer
128 views

Python REST API and Mongo - Aggregation Pipeline/Stage classes

This has been my approach for "simplifying" MongoDB aggregation queries in a pythonic syntax - was my intent, at the very least: ...
4
votes
2answers
128 views

MongoDB connection manager

I wrote a class for some MongoDB operations. So far I'm self-taught and mostly I follow the style from already existing code at my workplace (a startup). We don't have a code-review culture, so I'm ...
1
vote
0answers
414 views

What's the proper way to do MongoDB aggregation query with optional parameters?

I have this api endpoint where i want to lookup a user or multiple users schedule and also specify the month or/and the day when doing the query. My code works, but i feel like there is a better, ...
2
votes
0answers
74 views

Return aggregated values

It's the first time a write a non-trivial mongodb query, and I came up with one that does work, but is 123 lines long! Surely there must be a way to write it in a more concise way. The purpose of the ...
3
votes
2answers
67 views

Simple automation executing platform in Python

I'm building a platform like Rundeck/AWX but for server reliability testing. People could log into a web interface upload scripts, run them on servers and get statistics on them ( failure / success). ...
3
votes
1answer
2k 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
1answer
395 views

Import huge XML data set into MongoDB while parsing data

I am currently working with the Stack Exchange Data Dump - to be more precise - with the dumped Posts.xml data set from Stack Overflow. What am I trying to achieve?...
1
vote
0answers
41 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 ...
1
vote
1answer
923 views

connection to mongodb in golang

I am building an API server in golang with mongodb. My main.go file looks something like this: ...
3
votes
1answer
63 views

Speed up Python Script to populate MongoDB

How would I go about making this script much faster? Essentially it reads from a file and the slowest part is populating the words. In the words file there are over 100k words and I was looking for a ...
1
vote
0answers
113 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
1answer
1k views

Spring, Kafka and Mongo how to create a RestController

I'm learning how to use Kafka, I've never used something similar in the past. In my job I was required to create a POC using it and integrate it to Spring Boot and save information on MongoDB (because ...
2
votes
0answers
28 views

Representing LXC component configuration in django

I want to represent components of LXC in django; so I defined them in models: Container, Network, Profile and Devices where each one of them have a set of attributs, but when it comes to representing ...
1
vote
1answer
26 views

Express error if agency not found middleware

In an api I'm building, I have multiple routes that require an agency to exist before any action is performed on the requested agency. To avoid repetition I've written some middleware to check that ...
1
vote
0answers
84 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 ...
3
votes
0answers
125 views

Flashcard Website

In my endeavor to learn Angular, I've created a flashcard site with an F#/Mongo backend. As I'm new to Angular, I'm going to post everything; any and all feedback is welcome. First, some pictures of ...
2
votes
0answers
219 views

MongoQ - A Task queue system using Mongo

I've been using Beanstaldk (not Amazon's one) for years and loved the possibility to handle delays and priorities in the tasks, but I recently had to filters the tasks for specific reasons, and ...
7
votes
2answers
2k views

Insert 271 million records from text file to mongodb

I have 271 million records, line by line in a text file that I need to add to MongoDB, and I'm using Python and Pymongo in order to do this. I first split the single file containing the 271 million ...
2
votes
0answers
201 views

Synchronous use of Mongo-Scala Driver

The Mongo-Scala Driver (v2.6) currently only supports asynchronous operations, although my use cases often seem to lend themselves well to synchronous reads. This may be to block downstream code ...
1
vote
0answers
41 views

Store tweets to a local MongoDB server

I use NodeJS along with the MongoDB NodeJS Driver to store tweets into my local MongoDB server. In the following setup, mongos insertOne method gets invoked quite ...
2
votes
0answers
71 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
0answers
143 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
1answer
298 views

Enhancing search using Fuzzy Logic in NodeJS

Brief Description: In my NodeJS Application, I have a model called User. User.js ...
2
votes
2answers
473 views

Retrieve a city list for a country and state

The code below is working properly but how do I make this code faster and more efficient. How do I perfect this code? Let's assume I have 1000 country, state and city records in a mongodb collection. ...
2
votes
0answers
539 views

jQuery datatables data rendering from mongodb

I am using jQuery data Tables server processing to show some data to user. The documentation instructs that the response that the server sends must have this data: ...
4
votes
1answer
43 views

Get data and send mail script

I wrote a script using Python that gets data from several sources (news sites, Twitter, Yahoo), puts it into a dict and then formats it as a string to be sent through email. I wonder if there is ...
1
vote
1answer
474 views

Check mongodb status is running or not

I have written a program in golang which checks the mongodb is running or not using commands. But I'm not sure that the program is sufficient or there is something that needs to change in the program. ...
2
votes
0answers
1k views

Flask-PyMongo best practices to manage a mongodb database using python

The functions below are from a class of slave function which interact with my mongo database. The purpose is to serve a Flask based API by responding with the appropriate data required along with the ...
1
vote
0answers
88 views

Async API Function with Mongoose

I'm quite new to the language and I just started using async/await. I've written this function for an API that I'm developing. It checks what is sent by the user, specially the status that he wants to ...
-2
votes
1answer
78 views

How can I get this two functions into one

I have made some code in c#. I am currently developing a Gameserver so I have a function to update fields in the database. I also have a function to update the player-cash, but its like almost the ...
0
votes
1answer
88 views

Decompose big service class into small classes

Need to parse MongoDB collection and save parsed data into different postgres tables. MongoDB stores documents with different type field, for each type need to ...
0
votes
1answer
28 views

Node.js Data-Completion script

Following task: Customer-data, given in a JSON-file, have to be completed with additional address-data. Given in a second JSON-file. Then these data-stock has to be saved into a MongoDB-database. ...
1
vote
0answers
2k views

post Like/Dislike with mongoose/mongodb

Right now my route is doing the following: Searching for the post by id from the request parameters Check if the user already likes the post If the user likes the post, then increase ...