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.
188
questions
5
votes
1
answer
199
views
Mongo Queries In C++
The mongo API uses documents (encoded in BSON) as the way to perform queryies (for find / remove etc).
For example a query to find all record where the name field ...
2
votes
0
answers
22
views
C++ Mongo Interface : Version-2 Implementation of ScramSha Authentication
Refactored part of the original code:
c++ Mongo Interface
Implementation of ScramSha-256 for Mongo server to be used with the Authenticate class.
Example of Usage:
...
1
vote
0
answers
15
views
C++ Mongo Interface : Version-2 Authentication
Refactored part of the original code:
c++ Mongo Interface
In the original code I had put the authentication in the constructor of the socket stream. This made it hard to unit test. So I have ...
2
votes
1
answer
41
views
C++ Mongo Interface : Version-2 Op_Msg
Refactored part of the original code:
c++ Mongo Interface
This review is looking only at the "Op_MSG()" functions. These functions are used to read/write standard C++ objects to Mongo. The C+...
0
votes
0
answers
23
views
C++ Mongo Interface : Version-2 ConnectionBufferMongo
Refactored part of the original code:
c++ Mongo Interface
This review is looking only at the "ConnectionBufferMongo" class. This is derived from "ThorsSocket::SocketStreamBuffer" ...
4
votes
1
answer
82
views
c++ Mongo Interface
This questions needs some set up.
I have some code that serializes C++ objects into JSON/YAML/BSON.
Code here review here.
Simply you can serialize and de-serialize C++ objects to a ...
4
votes
2
answers
223
views
Connecting MongoDB using Motor in FastAPI
What are the best practices for connecting to a database in FastAPI?
To provide some context, I want to write code to connect to a MongoDB database using Motor. My idea is to create a single ...
1
vote
0
answers
50
views
React based Quiz Website
I have recently worked on a quiz application using the MERN stack. The application incorporates various features such as user authentication, quiz creation, scoring functionalities, and data ...
2
votes
1
answer
37
views
Do you think it's a good schema.prisma?
i'm trying to learn backend with Next JS, and i'm using Prisma + MongoDB. I want to create a simple website with a user with a cart and some products. here my schema :
...
0
votes
1
answer
74
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,
...
1
vote
1
answer
85
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 ...
1
vote
1
answer
75
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 ...
2
votes
2
answers
122
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 ...
2
votes
1
answer
108
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:
...
2
votes
1
answer
995
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 ...
1
vote
0
answers
108
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 ...
0
votes
1
answer
1k
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.
...
1
vote
1
answer
92
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 ...
1
vote
1
answer
113
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
2
answers
72
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.
...
4
votes
2
answers
938
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
0
answers
140
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
1
answer
653
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
1
answer
241
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
1
answer
387
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 ...
3
votes
0
answers
192
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
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:
...
2
votes
0
answers
740
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
1
answer
154
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
121
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
70
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
0
answers
259
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
1
answer
191
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
2
answers
237
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
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, ...
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 ...
3
votes
2
answers
85
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).
...
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
191
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
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?...
2
votes
0
answers
112
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
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:
...
3
votes
1
answer
84
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 ...
3
votes
0
answers
415
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
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 ...
2
votes
0
answers
36
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
1
answer
31
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 ...
2
votes
0
answers
115
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
0
answers
213
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
0
answers
760
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 ...