Skip to main content

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.

50 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4 votes
0 answers
411 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
0 answers
226 views

Get nearest driver from 2.5 millions of data using mongodb

I have created 2.5 millions drivers dummy data, in this case lets say the drivers are moving around in the city. The driver's document look like this : ...
Gujarat Santana's user avatar
4 votes
0 answers
2k views

Mongoose schema for products and social media posts

Here is my current schema: Brand: ...
NoobSter's user avatar
  • 193
3 votes
0 answers
186 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
3 votes
0 answers
413 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
3 votes
0 answers
212 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
3 votes
0 answers
2k views

MongoDB UPSERT in Python

I have code that scans our multiple SANS and inserts each file into a mongoDB. The code also checks the database first and if the document exists it updates the document. These are huge file systems ...
JRM's user avatar
  • 63
3 votes
0 answers
643 views

Populate MongoDB with random documents using a Go channel

I recently created a small app in Go that generates random bson documents and insert them in a database (MongoDB). See this question for details. After doing some profiling, I realised that garbage ...
felix's user avatar
  • 588
3 votes
0 answers
200 views

Simple picture app for storing and viewing

Update: git repo: https://github.com/muhsinali/picture-example-minified This is my first project that I've written using Scala and the Play framework. It's a simple application that allows the user ...
Calculus5000's user avatar
3 votes
0 answers
87 views

Knowledge base app using MEAN stack

I've been working on an app based on the MEAN Framework. I have got the app working but I just wasnt sure whether my coding structure and standard was good enough, meaning does it adhere to the ...
Lorenzo von Matterhorn's user avatar
3 votes
0 answers
56 views

Iterating a list to make API calls

I'm new to JavaScript and was hoping there was a cleaner way to write this. It's a block of code that looks at a group of documents in a collection (called Messages), and makes a call to the GitHub ...
Grant David Bachman's user avatar
2 votes
0 answers
737 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
2 votes
0 answers
257 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
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
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 ...
pfinferno's user avatar
  • 447
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 ...
Knox Root's user avatar
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 ...
khanhdn's user avatar
  • 21
2 votes
0 answers
746 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
  • 235
2 votes
0 answers
323 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
2 votes
0 answers
109 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
2 votes
0 answers
733 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: ...
Arootin Aghazaryan's user avatar
2 votes
0 answers
2k 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 ...
Bhaskar's user avatar
  • 121
2 votes
0 answers
43 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 ...
abrarisme's user avatar
  • 278
2 votes
0 answers
2k views

Python class to save objects into MongoDB

I am new in Python, and I am writing a Python class representing a calendar entry, each entry contains 2 properties: the date and its type, which can be weekday/weekend/legal holiday/paid holiday/...
user6417's user avatar
2 votes
0 answers
86 views

Create a stream request for Transaction history by client id on Braintree vault

I have been trying to create a transaction history request from Braintree using a client ID on Braintree vault, and it took far too long to figure out how, so here is the code on server that I ...
JonoD's user avatar
  • 21
2 votes
0 answers
174 views

Rewrite two mongo queries to aggregation

Here is a code block I have: ...
Nazar's user avatar
  • 71
2 votes
0 answers
44 views

Storing products in MongoDB with support for sorting by their number of followers

I'm loading products via an infinite scroll in chunks of 12 at a time. At times, I may want to sort these by how many followers they have. Below is how I'm tracking how many followers each product ...
NoobSter's user avatar
  • 193
2 votes
0 answers
665 views

Converting MongoDB's IAsyncCursor(Source) into an Rx Observable Sequence

I've been toying with this idea for quite a while. Needless to say that this really enables a lot of possibilities, Especially when combined with a SignalR Backend. Added below is what I came up with....
Eyal Perry's user avatar
2 votes
0 answers
478 views

Scoping through embedded document in MongoId

I'm using MongoId in a Rails project. I need to select some products which contain some SKUs which has an embedded document. The models are respectively Product and ...
Laurent's user avatar
  • 203
2 votes
0 answers
395 views

Wrapping MongoDB Call Results in Observables

I have a number of functions that follow the basic pattern below. The intent is to provide a MongoDB implementation for a storage interface in a TypeScript application. Is there a better way to ...
trgt's user avatar
  • 21
2 votes
0 answers
145 views

CRUDL actions on MongoDB collection using Mongoose and NodeJS

I am using Mongoose ODM and NodeJS to implement CRUDL operations on MongoDB for further use with REST API. Initially, I've implemented functions using Promises but then switched back to callback style....
Eugene's user avatar
  • 121
2 votes
0 answers
397 views

Node.js stream of objects from MongoDB

I have a collection inside MongoDB with thousands of documents. A document should be processing depending on some logic. To make the point simple, I suppose here there is a field ...
user1620696's user avatar
2 votes
0 answers
177 views

GitHub user graph crawler using akka

This code queries the GitHub followers API and stores the graph in a mongodb collection: ...
qed's user avatar
  • 1,419
2 votes
0 answers
105 views

Properly updating multiple MongoDB documents with Angular

In the app I'm creating, when a user upvotes a post, the post should be upvoted, as well as the user that wrote the post. But this updates two MongoDB documents. This presents a number of issues. I'll ...
anon's user avatar
  • 183
2 votes
0 answers
73 views

Trade off in database efficiency versus a nested for loop on client

I built an app where a user has a recipe box with recipes in it - for the db, there is a user and recipe model, user has "recipeBox" property. The recipebox is an array of objects like so: User ...
devdropper87's user avatar
2 votes
0 answers
35 views

Modify records at one time

Do you think this works well? I.e, do I need to close the database connection at the end? The goal is to be able to upsert and delete many records in one shoot. Here is is an example HTTP POST ...
János's user avatar
  • 121
2 votes
0 answers
400 views

Updating a list of a few dozen document resources in MongoEngine

This is my model: ...
latusaki's user avatar
  • 251
2 votes
0 answers
996 views

Log my external IP address using NodeJS

I've been learning NodeJS recently, and have a small program to get the external IP address on my home network from fugal.net, compare it to the previous IP address, and if there is a change update ...
Joseph McCarthy's user avatar
2 votes
0 answers
781 views

NoSQL-based sequence generator

For my web application I have to generate a sequence of following format: <year><sometext><month><sequence> For example: ...
ring bearer's user avatar
1 vote
0 answers
46 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 ...
Ultimate's user avatar
  • 143
1 vote
0 answers
107 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
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: ...
AviC's user avatar
  • 111
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
1 vote
0 answers
49 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
1 vote
0 answers
5k 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 ...
Asaf Aviv's user avatar
  • 111
1 vote
0 answers
900 views

MongoDB database abstraction

Backstory The company I work, we have the code below that acts as an abstraction of our database layer, which is mongoDB. This ensures our other code is not too dependent on the database. This is ...
Bjorn De Rijcke's user avatar
1 vote
0 answers
747 views

Handling MongoDB data for EJS file

I'd like to render mainly mongoDB data and an array. What I want to do is allow my EJS file to use the components inside the database. ...
Michael Gee's user avatar
1 vote
0 answers
1k views

Handle decimal in mongodb

I'm trying to find a way to handle decimals in mongodb. Is there any good way and/or should I handle it with a class like this: ...
random user 42's user avatar
1 vote
0 answers
3k views

A plugin that integrates Angular Smart Tables with Mongoose DB for server side pagination

I'm using Angular Smart Tables with data that might become a huge set of documents and rows. So rather than client side processing of the data for pagination, I borrowing code from two Mongoose.js ...
Adam S's user avatar
  • 131
1 vote
1 answer
50 views

Mongo command to add a field to all documents in a collection

This code appends a boolean column to all documents in the birds collection. ...
Powers's user avatar
  • 149