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
0 votes
1 answer
39 views

I have use this approch in my golang mongo REST APIs' DAO layer, need to clarify this is a good way or not

I have used this approach in my Golang MongoDB REST APIs' DAO layer, I need to clarify whether this is a good way or not, code is as follows, ...
Nisal Edu's user avatar
  • 103
0 votes
0 answers
36 views

Grouping and summing by condition from three mongodb collections

I have three mongodb collections. I would like to group the collections by date, month and year, then sum by condition in order to display totals from the three collections in one table. However, i ...
user20183888's user avatar
0 votes
0 answers
49 views

Cafegent backend: table management API using Express JS

I a new to coding and certainly new to this site. I apologise advance if I offend anyone or any rules. What should I do to further improve the code. Any suggestions would be appreciated. This code for ...
Debarka Mondal's user avatar
0 votes
0 answers
121 views

Link tracking with NodeJS

I want to create a service to track affiliate link clicks. The logic is simple, When a user is clicked on the link provided by the service will redirect to an original affiliate link. I stored data in ...
Siyum's user avatar
  • 1
1 vote
1 answer
74 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 ...
user8758206's user avatar
1 vote
1 answer
67 views

Pulling images from a MongoDb database

I have a method that on click produces an excel file with information in it. I have been asked to pull images from the data base and add them within the excel file as well. This is how I am pulling ...
Adil15's user avatar
  • 155
2 votes
2 answers
116 views

Change interface depending on if statement

I'm using fiber and mongodb. Field "field" is needed to obtain certain data to unload the load on the database. If field "field" is empty, then needs to output all the data from ...
Boro8ey's user avatar
  • 23
2 votes
1 answer
94 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: ...
user8758206's user avatar
2 votes
1 answer
725 views

MongoDB abstraction in Go with generics

I'm working on a new project with go. So I figured I would give this new feature a run (it's fun!). Although, I'm not sure I'm implementing this the way it's suposed to be. I've read the following ...
Russo's user avatar
  • 123
1 vote
0 answers
94 views

Whatsapp Bot using Mongodb

I have this Whatsapp bot made using Twilio and persistent with mongodb due to the nature of the logic I am following the code is become more of a cluttered and seems un-pythonic. It works fine as I ...
zerox's user avatar
  • 11
0 votes
1 answer
916 views

Mongodb connection retry

Created a MongoDB client which is handling the retry in case of server connection failure. Please review and how I can improve further. ...
Srikanth's user avatar
  • 135
1 vote
1 answer
89 views

Cleaning Kotlin method which returns the document name after the id

I'm just getting to know the possibilities of Kotlin and mongoDB. I am writing a method that returns the name of the street after the ID. Everything works, but I find it quite sloppy. Empty String ...
AdamK's user avatar
  • 35
1 vote
1 answer
92 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 ...
KeykoYume's user avatar
  • 203
2 votes
2 answers
69 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. ...
Bhaskar's user avatar
  • 133
4 votes
2 answers
547 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 ...
MetaCoder's user avatar
  • 153
1 vote
0 answers
117 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: ...
AviC's user avatar
  • 111
0 votes
1 answer
554 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? ...
Steve Ngai's user avatar
4 votes
1 answer
195 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) ...
Martin York's user avatar
  • 93.9k
2 votes
1 answer
292 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 ...
ATheCoder's user avatar
  • 123
3 votes
0 answers
161 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 ...
user232946's user avatar
5 votes
1 answer
185 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: ...
Razvan Zamfir's user avatar
2 votes
0 answers
693 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 ...
amos-baron's user avatar
1 vote
1 answer
151 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 ...
NPN328's user avatar
  • 751
2 votes
1 answer
105 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 ...
Utkarsh Pant's user avatar
6 votes
1 answer
67 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 ...
imnewhere's user avatar
2 votes
0 answers
232 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 ...
amos-baron's user avatar
3 votes
1 answer
161 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: ...
Rfroes87's user avatar
  • 133
4 votes
2 answers
223 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 ...
Vaibhav yB Shah's user avatar
1 vote
0 answers
1k 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, ...
Adrian Sultu's user avatar
2 votes
0 answers
76 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 ...
user000001's user avatar
3 votes
2 answers
78 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). ...
amos-baron's user avatar
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 ...
kibe's user avatar
  • 277
4 votes
3 answers
181 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 ...
Nodegeek's user avatar
  • 151
2 votes
1 answer
1k 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?...
djozefiak's user avatar
2 votes
0 answers
108 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 ...
pfinferno's user avatar
  • 447
1 vote
1 answer
3k views

connection to mongodb in golang

I am building an API server in golang with mongodb. My main.go file looks something like this: ...
Santosh Kumar's user avatar
3 votes
1 answer
82 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 ...
Menace's user avatar
  • 293
3 votes
0 answers
372 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 ...
ubuntu7788's user avatar
2 votes
1 answer
3k 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 ...
Frakcool's user avatar
  • 181
2 votes
0 answers
34 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 ...
Knox Root's user avatar
1 vote
1 answer
30 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 ...
mrmadhat's user avatar
  • 158
2 votes
0 answers
114 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 ...
khanhdn's user avatar
  • 21
3 votes
0 answers
201 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 ...
user avatar
2 votes
0 answers
665 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 ...
Cyril N.'s user avatar
  • 245
7 votes
2 answers
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 ...
Diandro's user avatar
  • 71
2 votes
0 answers
299 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 ...
schwadan's user avatar
1 vote
0 answers
48 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 ...
Aley's user avatar
  • 261
2 votes
0 answers
105 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 ...
Anthony's user avatar
  • 21
4 votes
0 answers
384 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: ...
Matt Carlotta's user avatar
4 votes
1 answer
632 views

Enhancing search using Fuzzy Logic in NodeJS

Brief Description: In my NodeJS Application, I have a model called User. User.js ...
Sudarshana Dayananda's user avatar