I am looking to add to multiple sets, and at the same time update the updated_at timestamp (touch). I could do this using the mongo driver:
db.mycollection.update({"_id": ObjectId("911")},
{
$addToSet: { "hashtags": {$each: ["#test1", "#test5"]}, "new_hash": {$each: ["test9"]} },
$set: {"updated": "current time 3"}
}
)
How can I do this using mongoid in a rails app, in a single update query. Right now, I need to do 3 writes using mongoid:
my_object.add_to_set("hashtags", ["#test1", "#test5"])
my_object.add_to_set("new_hash", ["test9"])
my_object.touch