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

learn more… | top users | synonyms

1
vote
0answers
9 views

GitHub user graph crawler using akka

This code queries the GitHub followers API and stores the graph in a mongodb collection: ...
1
vote
0answers
15 views

Matching a current user's “liked / followed” items with results from a search query

This is pretty ugly now. My main objective is to perform a search query, which I do via mongoosastic / elastic search (the search paginates 12 items at time). Then, I want to match those results with ...
1
vote
0answers
36 views

Basic Express + NodeJS REST API

I've created a REST API Endpoint for my website's Dashboard. ...
0
votes
0answers
39 views

Generating a random ObjectID

We want to ensure that certain documents in our DB get distributed well across the shards. Currently the documents are sharded by their _id, but they are often ...
0
votes
0answers
7 views

Function to check if a mongoose object contain a subfield [migrated]

The following code doesn't work properly, I want to check after my mongoose findOne query if some subdocument in my object are defined. ...
1
vote
0answers
41 views

Mongoose schema for products and social media posts

Here is my current Schema Brand: ...
1
vote
0answers
35 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: ...
1
vote
0answers
13 views

MongoDB Per-Module Reusable DB Object With Reconnection Handled

This implementation was derived from the following requirements. I would like to learn that whether the implementation is clean enough, without memory leak and performance hit. Requirements Always ...
2
votes
1answer
70 views
0
votes
1answer
71 views

Country lookup for locations in an array

I've got a method which get's a JSONObject as input which internally has a JSONArray. The problem is that one of values in the JSON Array is a country code, but when I return the final structure it ...
2
votes
1answer
76 views

MongoDB CRUD operations for various types of data in Go

First of all I am a newbie in Go. I wrote a CRUD REST API that consists of handlers, a database layer and so on, and it contains a lot of code duplication. I see some patterns here, and I know how to ...
1
vote
0answers
38 views

Locate enteries to the nearest date selected

This code loops through a given range of dates and for every 5 minute iteration pulls up the last known records of the users in the database relative to that timestamp. I'm trying to find a way to ...
2
votes
2answers
57 views

RSS to JSON for insertion into MongoDB

In my code, there is a chain of functions call where the deepest function may throw an exception. I catch and handle it according to the business logic. The problem is that all other functions in the ...
3
votes
1answer
68 views

Retrieve rich text from GridFS with Java

I am writing a storage for articles and I have decided to use GridFS from MongoDB. I have found and tested some code, but I am not sure that it is a best one. Could you advice me how to make it better?...
2
votes
0answers
76 views

Managing modules in phone book app

This is a test app built with NodeJS, Express and MongoDB. This code is the main and complete JavaScript file. I would like suggestions on dividing it into different modules and making the main app.js ...
1
vote
0answers
27 views

Script to migrate event, artist, and venue information from MongoDB to Drupal

At first I brute forced the migration to just get it finished. However, the procedural program mixed the events with the venues so I rewrote it, this time using classes which I'm just beginning to use....
2
votes
0answers
53 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 ...
1
vote
0answers
68 views

Using mongoose aggregate function and saving to user model

Any thoughts on making this better? ...
1
vote
0answers
28 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 ...
3
votes
1answer
143 views

Nesting BsonDocuments in MongoDB queries

I have a MongoDB collection setup where each document's JSON looks like this: ...
2
votes
0answers
200 views

Sentiment analysis on tweets in MongoDB

What i have done here is used 2 scripts in which from my main file I am using streaming api for particular handles and that data being directly pushed to ...
4
votes
1answer
47 views

MongoDB - Find records in one collection that match string in 2nd collection

I have a MongoDB collection of product IDs/unique products attributes and a second collection of codes that relate to attributes common for products whose IDs are prefixed with those codes. For ...
5
votes
1answer
132 views

Listening from Mongodb always and triggering

I am using classes for the first time. In this program I want the object to run infinitely so that any change in the MongoDB will trigger the function and do the necessary processing. I am little ...
1
vote
1answer
137 views

mongodb query in waterline,sailsjs

Because it is a lot of code, I don't want to ask for details what is wrong, but want to ask about review what can be changed in approach to this. This is controller that make query: It grabs data ...
3
votes
1answer
175 views

Updating state with React

I am creating a blog using React, MongoDB, Express and Node. I have three components: App, List, and Item. The item is a blog post; the list is a list of the blog posts, and the app includes a place ...
5
votes
1answer
106 views

Image duplicate finder

I have a bunch of exact-duplicate pictures that I've acquired over the years. I'd like to create a list of all them so I can eventually delete some. My idea was simple: dump the hash and location of ...
14
votes
2answers
146 views

Builder pattern for users in document database

I'm attempting to make a builder pattern that makes sense and is practical for storing user data in a flexible way in a document database. The DB I chose is MongoDB, and I'm using its Java API ...
2
votes
0answers
46 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 ...
0
votes
0answers
1k 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 ...
3
votes
2answers
151 views

Check duplicate items in Mongodb

I need to query MongoDB and check if an item exists or not: ...
7
votes
3answers
57 views

Pulling Docker Machine IP

I am working with MongoDB through Docker, and I have a terrible bash command to pull the Docker Machine IP so I can sanely connect locally. ...
8
votes
1answer
57 views

Retrieving StackExchange sites and tags

I have setup agenda tasks to periodically retrieve and possibly insert new SE sites and tags in my MongoDB database. Some things that bother me in particular: Lots of code duplication No string ...
0
votes
1answer
103 views

Flattening a 2D array to use map/reduce

I have been trying to get better at functional programming, which includes understanding map/reduce. I wrote a function intended to fill an autocomplete with values. The challenge I was encountering ...
4
votes
2answers
2k views

Get all followers and friends of a Twitter user

I'm trying to find my bug or any potential bottleneck that cause my program to be really slow. The script is to get all the followers and friends and save that in MongoDB. ...
1
vote
0answers
54 views

Pulling data quickly from mongodb with node.js

I am currently struggling with a request I am making to my server that is taking more than 4 seconds! I cut out a lot of the cruft to hopefully make it easier to read. Excuse my horrible variable ...
1
vote
0answers
202 views

Game server in Java querying MongoDB for JSON

I was hoping someone would have a look at how I retrieve the questions from the db, parse the JSON and process the results - possibly advise how I could improve efficiency by streamlining my code. I ...
0
votes
1answer
210 views

Multi-player game server accessing and querying MongoDB

I have a remote hosted server that's running Java VM with custom server code for a multiplayer real-time quiz game. The server deals with matchmaking, rooms, lobbies etc. I'm also using a MongoDB on ...
0
votes
0answers
542 views

MongoDB repository, dynamic objects, Razor Templates

I am writing a repository for MongoDB and are looking for some review at its current state. I am looking for ways to improve it without adding complexity. Should I be using a Singelton pattern for ...
2
votes
0answers
29 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 ...
7
votes
2answers
100 views

Recursive download articles and dump to MongoDB

This is simple code that recursively downloads articles from the public WordPress API: ...
8
votes
1answer
276 views

One-to-many relationship with Python objects

I have built Python objects to simulate a one-to-many relationship and then store the object in a MongoDB instance. I am using lots of composition to achieve what I want. The code works perfectly fine ...
3
votes
1answer
167 views

Realtime chat service

I am new to Node.js and Socket.io. I implemented a realtime chat service that has a chatroom feature. When the actual product is launched, there will be at least 200 concurrent users with 50 groups of ...
0
votes
1answer
165 views
4
votes
1answer
96 views

Tabulating a report

I have a method for generating a report in Python. I want to organize the section about the date into a separate method so I can repeat the report for different dates. What's the best way to ...
1
vote
3answers
65 views

Top-10 lists of occupations, ranked by various attributes

In the code below, all pairs of functions are very similar: set function rankListId is different rankListName is ...
2
votes
1answer
1k views

Node.js Paging with Mongodb

I want to create variable paging on Node.js with MongoDB. I use MongoJS on client side create a request: ...
2
votes
0answers
129 views
1
vote
0answers
25 views

Nesting models within models

I am saving data into a MongoDB. The data will be saved into 3 Mongoose models that are hierarchical. A User model contains an ...
2
votes
2answers
116 views

SQL Server to MongoDB Template

Looking for feedback on a set of templates I've just created. I'm planning on converting them to Yeoman but want to make sure they're ready for prime time before doing so. They are currently in ...
3
votes
1answer
63 views

Probability ordering by seller's tariff

I have an instance method which calculates the position of an element, depending on the tariff of its seller. If the seller is of a level3 tariff, it gets to top ...