skip to Main Content

Mongodb – I need to do a mongo lookup on data, but want an empty array where no data is found

I am new to mongo and I've got a query that I am running as seen below: db.getCollection('equityprice_input').aggregate([ {'$match': {'mrsBusinessDate': '2022-05-05', 'instrument': 'other', 'sourceSystem': 'bloomberg', 'mrsTime': '17:00:00', 'dataType': 'price'}}, {'$lookup': {'from': 'equityprice_input', 'localField': 'data.securities', 'foreignField': 'data.securities', 'as': 'staticData'}}, {'$project': {'_id':…

VIEW QUESTION

Update nested array mongodb

I want do an updateMany() operation on a nested array for all documents of my collection. Here is the documents format : { "number": 1, "products": [{ "name": "test", "compositions": ["water", "sugar"], }] }, { "number": 2, "products": [{ "name":…

VIEW QUESTION
Back To Top
Search