我有嵌入用户的通知。在Mongoid中,我将如何实现类似的查询。下面的查询使用Mongdb完成:Mongoid,通知帮助
MONGODB site_name_development['users'].update(
{"_id"=>BSON::ObjectId('4ce694e672357e015a000014'),
"notifications._id"=>BSON::ObjectId('4ce694e672357e015a000017')},
{"$set"=>{"notifications.0.is_active"=>true}})
基本上,如果我有用户Foobar。 Foobar有3种类型的通知。我想通过将is_active设置为true来打开其中一个通知。同时所有其他通知的is_active应该设置为false
应该执行什么查询?