skip to Main Content

Mongodb – How can I optimize this query in mongo db?

Here is the query: const tags = await mongo .collection("positive") .aggregate<{ word: string; count: number }>([ { $lookup: { from: "search_history", localField: "search_id", foreignField: "search_id", as: "history", pipeline: [ { $match: { created_at: { $gt: prevSunday.toISOString() }, }, }, {…

VIEW QUESTION

Mysql – MongoDB nested array query how to

I am trying to query a document in my MongoDB Document: { _id: '111', subEntities: [ { subId: '999', dateOfStart: '2098-01-01', dateOfTermination: '2099-12-31' }, { subId: '998', dateOfStart: '2088-01-01', dateOfTermination: '2089-12-31' } ] } My Query: {"$and": [ {"subEntities.dateOfStart": {"$lte":…

VIEW QUESTION
Back To Top
Search