摘要:Java & MongoDB 修改內嵌文章中陣列文章中的單一資訊
DBCollection collection = db.getCollection(collection_name);
BasicDBObject query = new BasicDBObject();
query.put("_id",_id);
BasicDBObject pid_query = new BasicDBObject();
child_query.put("child_id",child_id);
BasicDBObject inbox_query = new BasicDBObject();
childs_query.put("$elemMatch",child_query);
query.put("childs",childs_query);
BasicDBObject update_object = new BasicDBObject();
BasicDBObject update_data = new BasicDBObject();
update_data.put("childs.$."+status,status_value);
update_object.put("$set",update_data);
collection.update(query,update_object);