I have the following mongoose schema:
user = { \"userId\" : \"myId\", \"connections\": [{ \"dateConnectedUnix\": 1334567891, \"is
You can do it in mongoose 5.4.x and above
mongoose 5.4.x and above
const result = await User.findByIdAndUpdate(user_id, { $pull: { someArrayName: { _id: con_id } } }, { new: true }); if (result) console.log(result)
The item from connections array will be removed based on provided property _id value
item
connections
_id