Questions tagged [pymongo]

PyMongo is the official Python driver for MongoDB created and maintained by MongoDB, Inc.

Filter by
Sorted by
Tagged with
3 votes
0 answers
37 views

Python Script that searches a corpus for most relevant results according to search terms

I am currently working on building a small search engine (if it can be called that) that allows users to search for relevant articles from a short list of other older websites that do not have search ...
  • 31
0 votes
0 answers
14 views

Is there a way to speed up the group stage of the MongoDB aggregation pipeline?

I am trying to find all the "missing" devices in our database. Therefore I filter for the existing device ids and then prepare the data to be presentable and usable. The question I have is ...
  • 165
2 votes
0 answers
202 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 ...
2 votes
0 answers
269 views

Utilising pymongo to scrape over 4 million urls using multiprocessing to examine the impact of coronavirus

So I want to do some research on the impact COVID-19 is having on businesses. I've managed to generate a database with the company name and the website URLs associated with it. Now I want to scrape ...
  • 121
2 votes
1 answer
68 views

How to think smarter when you need diff args in functions

I have this code, and the point is I want to dynamically change the mongo connecter to change between ssl, not ssl and with and without username in the same connecter function. ...
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 ...
  • 71
1 vote
1 answer
72 views

Work command handler for an economy system

I have been working on this code, which is the part of an economy system that handles the work command. This lets the user pick a role and if they have enough level then they will get it by updating a ...
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 ...
  • 121
1 vote
1 answer
273 views

Models in a Simple PyMongo-based Blogging Web App without ORM/ODM

I am currently using PyMongo + Flask for building a simple blogging application. I am not using any kind of ODM, instead I decided to use PyMongo directly. I need to know how to improve my code since ...
3 votes
1 answer
159 views

RAII style API wrapper for PyMongo

I just watched Raymond Hettinger's talk on making Python more Pythonic and realized I should be putting a lot of his ideas into practice, particularly wrapping API's in a class that makes everything ...
  • 1,825
4 votes
1 answer
194 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 ...
5 votes
1 answer
1k views

E-commerce product price tracker

I building a very simple price tracker web app. I am using MongoDB with pymongo. The user will enter the URL of the product he wishes to track and the desired amount, when the price goes below this ...
  • 973
2 votes
1 answer
268 views

Views Counter made in Python, Gevent and MongoDB

I've created a Views Counter in Python, Gevent and MongoDB (Flask is also included in the full stack as you can see from the context issue in the code). My gut still tells me that it can be still ...
3 votes
2 answers
3k views

Number of Google search results over a period of time, saved to database

I am writing a Python script that scrapes data from Google search results and stores it in a database. I couldn't find any Google API for this, so I am just sending a HTTP GET request on Google's main ...
  • 973