Skip to main content

All Questions

Tagged with
0 votes
1 answer
35 views

Mongo How to get only available documents by date

I have documents that associated to students: [ { '_id': 1, 'name': 'Anna', 'vacation_start: '2024-01-01', 'vacation_end': '2024-01-03' }, { '_id': 2, 'name': 'Bob', 'vacation_start: '2024-01-01', '...
Zesshi's user avatar
  • 481
1 vote
1 answer
62 views

MongoDB $lookup on multiple conditions: join with empty array field

I have two collections,inf and data. inf sample: { "_id": { "$oid": "662bb5218bd38ee73cd579f0" }, "point": 12, "code": "bc010", ...
eazyezy's user avatar
  • 79
0 votes
1 answer
33 views

MongoDB - Convert response into array of object in query

I wrote a simple query in MongoDB to get all data related to the product ID. Now I want to convert my response into an array of objects. Please see below. Query: db.collection.find({ "product_id&...
Unknown Developer's user avatar
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,...
aneroid's user avatar
  • 15.3k
0 votes
2 answers
27 views

Querying for deeply nested subdocuments in Mongoose

I've been having trouble trying to query for a deeply nested subdocument while using Mongoose. My DB structure is like this: { "_id": "662aa6ccae109745e30dc664", "...
O'Diego's user avatar
0 votes
0 answers
43 views

Populate Array object using typegoose

I have following structure in typegoose. How do I populate role based on RoleId as it is inside array? export class PermissionBase { @prop() permissions?: { roleId?: Ref<Role>; ...
Anonymous Creator's user avatar
1 vote
2 answers
41 views

MongoDB - Update a field based on another field within the same doc in the array

I have a collection of data like this: { "items": [ { "product": { "name": "prod1", "price": { "...
Babak's user avatar
  • 188
1 vote
4 answers
63 views

How to sort by the smallest value from multiple fields?

I have list of mongo documents [ { "created_at": "2024-03-15T18:11:18.687", "updated_at": "2024-03-15T18:11:28.945", "fields": { &...
Zessshi's user avatar
  • 71
-1 votes
1 answer
39 views

mongo db conditional update, push data

I have a MongoDB database structured as follows: { accountName: "pippo", whishList: { element1: [ { price: 25, time: '2024-02-20T20:00:00.000+00:00' }, ...
frangu77o's user avatar
2 votes
1 answer
38 views

MongoDB - Add array elements

When I am trying to run: {$push:{"Training_to_Attend":["Python","DBMS"]} My output is "Training to Attend" : [ [ "Python", "DBMS" ] ] ...
Karthik P G's user avatar
1 vote
1 answer
61 views

Updating object in deeply nested arrays mongoose

{ "_id": "659e76b929be316e566cdc36", "main_array": [ { "_id": "659e76b929be316e566cdc39", "sub_array": [ [ ...
ARHAM RUMI's user avatar
-4 votes
1 answer
56 views

Fetch details from arrays in mongodb

I have imported details about a YouTube Channel to mongodb and i am trying to get the details of YouTube Channels Video. Say I am trying to get the "VideoDetail"-> Video_Id -> ...
rinkaka chirikato's user avatar
0 votes
1 answer
134 views

How to upsert multiple object by array in JS?

I have an array with an objects from which for each object i need to find if some key exist then it should update or else insert. I have done this from for loop but problem is i have approximately 20L ...
Piyush's user avatar
  • 590
0 votes
1 answer
44 views

MongoDB query to transform documents

I have the documents structured in MongoDB 6.0 as below: [ { "_id" : ObjectId("6555a7d7c2d9de74abb09de8"), "tagName" : "tag1", "...
Bhanu's user avatar
  • 1,065
0 votes
1 answer
29 views

How to get intersection data of a field from multiple Mongodb document's field's data. Want a Mongo aggregate Query which I can add in my query

I am already using a Mongo db Aggregate Query to get a array of output. email will be the array of emails as input in the query. **aggregateQuery** = [ { '$match': { 'email': { ...
Vishal Gupta's user avatar

15 30 50 per page
1
2 3 4 5
55