How to insert json object inside nested object in a document based on nested object UUID

30
November 26, 2020, at 06:00 AM

I am working on a small project and I am stuck from last month and looking for an exact query to update my document at the exact location...I did my best but didn't get my goal....Please help.

My Current Query

await test.update(
{
   "subtests.uuid": req.query.sub_uuid
},
{
   $set: {
      $push:
            {
               "subtests.$[element].subtests": req.body
            }
         }
},
{
      arrayFilters: [
         {
            "element.uuid": req.query.sub_uuid
         }
      ]
});

With this query, I am getting an error saying (Typeerror: Callback.apply is not a function)

MongoDb Document Image

Error

Thank You to everyone who holds my hand in this complex query (for me it very complex because I am trying to solve it from the month)

READ ALSO
Trying to return from co generator runner in nodejs

Trying to return from co generator runner in nodejs

I want to create a function that runs asynchronous code sequentialyThis function takes parameters and returns a Promise that resolves with a JavaScript object

52
Problem with my ToDoList , findAndRemoveById dont work

Problem with my ToDoList , findAndRemoveById dont work

im doing my course and now making a ToDoList and upgrading it with mongoose but the problem is that in this video everything work fine but for me its showing ,,Argument passed in must be a single String

26
How to migrate a whole React.js web-app to Typescript [closed]

How to migrate a whole React.js web-app to Typescript [closed]

Want to improve this question? Update the question so it's on-topic for Stack Overflow

37