All Questions
Tagged with mongodb-query python
460
questions
0
votes
1
answer
34
views
Update a Column of a Matrix where each MongoDB document is a Row
I'm storing matrices in MongoDB where each document is a row of values. Example of two small matrices but assume there are thousands of rows and columns:
[
{ matrix_id: 123, row_id: 0, values: [1, 2,...
0
votes
0
answers
244
views
MongoDB BEanie ODM - Get all Documents linked to a Document
I have a Many to One relation, no BackLinks, if I have a Document, how, can I get all Documents linked to it?
I tried the following, but I just get an empty list back []:
import asyncio
from models ...
0
votes
0
answers
102
views
MongoDB fuzzy text search or simple sorting but always with pagination token
My question is: what is the best practice for querying a MongoDB when you need to do either a fuzzy text search and sort by search score, or do an unfiltered query that sorts by a property, but both ...
0
votes
1
answer
40
views
How do I query the "expiryDate" field within an array of objects when the objects do not have a field name?
I'm working with a JSON file containing objects structured like this:
[
{
"_id": { "$oid": "65143f76653355483f68981d" },
"date": "2023-09-27"...
1
vote
1
answer
49
views
MongoDB - How to delete documents which included in a list
I want to delete documents from a collection which are not included in a list with Python.
All documents have a title field, and I have a list of the titles.
The list of titles is like below:
titles = ...
0
votes
0
answers
165
views
Mongodb: how to make task queue system and find/update_many in 1 query?
python: 3.9.17
pymongo: 4.5.0
OS: Ubuntu 20.04
server (one of): Intel(R) Xeon(R) CPU E5-2695 v4 @ 2.10GHz 72 cores
I am creating an app where users send tasks on high load (around 300 tasks per ...
0
votes
1
answer
54
views
Mongo DB .find_one(query) doesn't find results
I am trying to check if a user exists in my database based on the contact information (name, surname, email) that I have retrieved from data. I know that this information exists in my database but for ...
1
vote
1
answer
37
views
Insert if it doesn't exist, update based in ADDITIONAL condition [mongoDB]
I'm creating a sync system in which I have the following type of data:
records = [
{'_id': 0, 'name': 'John', 'sync_date': '2022-01-01 00:00:00'},
{'_id': 1, 'name': 'Paul', 'sync_date': '...
0
votes
0
answers
69
views
Decoding a binary-like object back to the original string
I'm using python and mongodb.
I have the following string example:
hash = 'Z0pQ5dJos8Lz8USN/5P955P7228eW1BDPieuX+AgqvI='
I want to wrap it into BinData type in mongo, so I do the following:
self.db....
0
votes
1
answer
36
views
Improve MongoDB query in Python
I have a MongoDB database including hiking trails that I visualize in a Jupyter Notebook. Each trail has a start and destination and includes a timestamp when it was updated. So there are multiple ...
-3
votes
1
answer
74
views
MongoDB 10m search documents
How can I optimize mongoDB search if I have 10+ million documents in one collection? If anything, please, don't advise me to switch to mysql. I need mongodb specifically
For example one of the logs
{
...
0
votes
0
answers
175
views
How can I filter by date range in mongo db with python?
I have a mongodb database for a python and fastapi web application. The data stored in the collection has the following structure:
[
{
"_id": "6457dc8740f35d494c0c76a4",
&...
1
vote
1
answer
84
views
asyncio+pymongo two cursors parallel iterate not working
My goal is to query data from two mongodb databases, src and dst, but the time-consuming of the following two writing methods is the same. Is there anything wrong with me?
1.The src and dst query ...
0
votes
2
answers
361
views
MongoDB find: Query a field which has a nested dictionary structure
I have a collection which has one of the fields in it as a nested dictionary.
Sample:
{
"_id": ObjectId(""),
"family_member": {
"mother":{
"...
0
votes
1
answer
30
views
Add New Field to MongoDB Collection Array Based on Existence of Another Field in Array Using Aggregation
I have a document in collectionA of the following format:
{
"_id" : ObjectId("641893db137e63c5d6940f68"),
"summaryId" : 20,
"actions" : [...