Skip to main content

All Questions

Tagged with
1 vote
1 answer
28 views

Create array of elements based on another existing array using MongoDB Aggregation

I need to take a field from a document as input, like below: "participants": ["John", "Peter"], and make the output field like that: "participants": [ { ...
Mathias Hillesheim's user avatar
0 votes
0 answers
51 views

field indicating last modification of a documont in mongodb

I am building an API over my mongodb cluster. Each call for the API should return only the newest values or the values that have been modified seen the last call. I thought i need to add a field to ...
katz daniel's user avatar
0 votes
0 answers
37 views

in mongodb how do i save the last instance of archive entities

I have a a stream of entity transactions. Each transaction is a json consists of "_id" of the entity and a time of the transaction (there are many more fields). I want to save in the last ...
katz daniel's user avatar
0 votes
0 answers
42 views

Using SQL LIKE operator in MongoDB indexes

I have a Flask app that queries my self-managed MongoDB. I've created an index on two fields so that I can perform a text search on it. The search is working fine, but it is only matching full words. ...
Mervin Hemaraju's user avatar
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 ...
Ayato-Stack's user avatar
0 votes
1 answer
28 views

Bulk update using pymongo, merging python dictionary and DB collection

As an example, suppose we have the following dictionary list in memory dict_list = [ { 'id': 1, 'from_value_key': 'x' }, { 'id': 2, 'from_value_key': 'y' }, { 'id': 4, ...
user23604252's user avatar
1 vote
1 answer
34 views

MongoDB: Map array of ids to objects while preserving order via aggregation functiona

I am using MongoDB to create a playlist maker. I have two separate collections: Playlists { "_id": { "$oid": "65e7a3006b0209462d08a5f5" }, "playlist_name&...
Ben Goldstone's user avatar
1 vote
1 answer
64 views

Is there a mongo operation for getting the count of documents in a sorted (and or filtered) collection after and before a provided document (_id)?

For example, with pymongo: I'm adding new document like this with a sequential index. DB_1 = mongo ["DB_1"] collection_1 = DB_1 ["collection_1"] collection_1.insert_one ({ '...
Bryan Grace's user avatar
  • 1,861
-1 votes
1 answer
61 views

Struggling with MongoDB grouping by year, month and day query [duplicate]

DB STRUCTURE date: 2022-01-01T03:28:00.000+00:00 (Date) value: XXX (int) write a queries to group documents by year, month and day summing relative values filter_cond = {"$match": {"dt&...
Alan Dzheliev's user avatar
0 votes
0 answers
50 views

How to get below format output data from Mongodb collection

expected output example: {count of job:number,sum of assets:number,count of job group by status:number,list of policy:policyname +policyid}. { "_id" : ObjectId("...
Vivek's user avatar
  • 1
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 = ...
boketeボケて's user avatar
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 ...
sirjay's user avatar
  • 1,713
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 ...
Isabelle's user avatar
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': '...
Antoniou's user avatar
  • 155
0 votes
1 answer
33 views

How to avoid duplicates in nested document while updating

My data model looks like this screenshot, also shown here: { "_id": "619f6735336c8d0498bb5d00", "name": "Class 1", "department": "...
parithi ip's user avatar

15 30 50 per page
1
2 3 4 5
47