Wednesday, February 10, 2016

MongoDB "update" Only Updates One Entry by Default

The "update" command only updates the first matching entry by default. To update all entries, there is a third parameter i.e. "options" where you need to set "multi: true" e.g.
db.coll.update({},{$set:{"attr":”value”]}},{multi:true})

Reference: https://docs.mongodb.org/v2.4/reference/method/db.collection.update/

AWS IAM: EC2 Full Access to Region

Example:
{
   "Version": "2012-10-17",
   "Statement": [
       {
           "Sid": "xxxxxxxxxxx",
           "Effect": "Allow",
           "Action": [
               "ec2:*"
           ],
           "Resource": "*",
           "Condition": {
           "StringEquals": {
               "ec2:Region": "us-west-2"
           }
       }
     }
   ]
}

Reference: http://stackoverflow.com/questions/18112784/iam-allowing-a-user-to-access-everything-for-ec2-on-a-region