All Questions
Tagged with mongodb-query database
468
questions
1
vote
0
answers
27
views
Is `{ field: { $in: [null, 'something-1', 'someting-2', []] } }` performance wise okay to use than separate query?
Query 1 : { field: { $in: [null, 'something-1', 'someting-2', []] } }
Query 2 :
{
$or: [
{ field: { exists: false } },
{ field: { $in: ['something-1', 'something-2'] } },
{ ...
0
votes
0
answers
45
views
MongoDB: Filter array field based on entry from the same array
Given the following collection
db.playground.insertMany([
{ "id": 1, "tags": [{"t": "T1", "v": "t11", "c": 1 }, {"t": &...
0
votes
0
answers
32
views
Want to extract specific column and fetch count based on the condition
I have below documents in Mongo DB:
{_id
666b07c615b7246
host
"SERVER1"
ip_address
"10.0.0.1"
status
"Running"
timestamp
2024-06-13-01-00-10}
{_id
666b07c615b7246
host
&...
0
votes
1
answer
51
views
slow Mongodb regex for 200 million documents
I have a MongoDB collection with around 200 million entries for different websites. The documents are structured like this:
{
"_id": {
"$oid": "6647314adcfdad8dd8b1c84f&...
0
votes
1
answer
39
views
Need advice on MongoDB schema for multiple types of items in a single collection
I am designing an "Itinerary Planner" application. The concept is pretty simple, each itinerary will have three types of items:
transportation: Has fields like startDate, endDate, provider, ...
1
vote
0
answers
39
views
MongoDB Find Id in Array without knowing nested object path
QUESTION
I need to query data that is stored in mongo and find a particular id within an array without knowing the name of the sub key. In my example below, I am trying to find "AA" within ...
0
votes
0
answers
77
views
MongoDB UpdateMany query TimeOut
I'm trying to add a field to the existing collection in mongoDB (It has around 100k documents), when I'm using updateMany to add this, the request is updating a few records (around 2k) and facing ...
0
votes
1
answer
28
views
Reference Existing fields in Update Query MongoDB
I am trying to add a new field to my collection in MongoDB (This collection has around 40k documents) using existing fields in the document, I'm running the below update query
db.myCollection....
1
vote
1
answer
115
views
Mongo DB left join with one to many relationship
Please I need help with this Mongo DB code.
I have two tables(collections) which are orders and users. My orders table has a referencing field named userId that references the user who made the order. ...
0
votes
2
answers
180
views
How mongodb chooses the index while executing a query when multiple indexes exists
I have a MongoDB collection that stores some test submissions. The highlevel schema looks as follows.
{
"lessonType": "quiz",
"userId": "639cb6d9513a420026eddca1&...
2
votes
1
answer
35
views
MongoDB matching array against value in nested documents
I have searched around this problem I am facing for a bit but I haven't found a good solution without using the $lookup parameter.
My Documents currently roughly look like this:
{
...
problems:...
0
votes
0
answers
28
views
How do i fix a typeError when using node.js to connect to Mongo db and is my code correct?
I have a database called Exams and inside Exams is a document called Math_Exams so I am trying to store that in an array but my connection to the database does not work and this error appears after ...
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
97
views
getting black screen in 2-3 sec in mongodb-compass ubuntu
UBUNTU_MONGODB_COMPASS
1.first i install mongodb-compas(gui) and type in terminal sudo dpkg -i file_location
and after that click on mongodb icon the application is open but after 2-3 sec every thing ...
1
vote
1
answer
91
views
Comparing fields of 2 documents from same collection to produce a diff
I have a system that
I wish to produce history of changes that happened to the documents in a collection at a particular timestamp
So let's say we have a document in a collection
[
{
"...