I have the following mongoose schema:
user = {
\"userId\" : \"myId\",
\"connections\":
[{
\"dateConnectedUnix\": 1334567891,
\"is
It seems that the above code would not work. It should not even have worked for the first example I gave.
In the end I was supported by this answer here: MongoDB, remove object from array
Here is my working code:
userAccounts.update(
{ userId: usr.userId },
{ $pull: { connections : { _id : connId } } },
{ safe: true },
function removeConnectionsCB(err, obj) {
...
});