)]}'
{"ceilometer/storage/impl_mongodb.py":[{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"453fd36184cd1c2c610940c5ddb145b558251d95","unresolved":false,"context_lines":[{"line_number":531,"context_line":""},{"line_number":532,"context_line":"    def update_alarm(self, alarm):"},{"line_number":533,"context_line":"        \"\"\"update alarm"},{"line_number":534,"context_line":"        If alarm.alarm_id is set then update, else insert."},{"line_number":535,"context_line":"        \"\"\""},{"line_number":536,"context_line":"        aid \u003d alarm.alarm_id"},{"line_number":537,"context_line":"        data \u003d alarm.as_dict()"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAOn%2F%2Fmjw%3D","line":534,"updated":"2013-05-02 07:20:27.000000000","message":"what if the user set an alarm_id which does not exist in the DB? Do we allow the user to create new alarm with specific alarm_id?","commit_id":"63a521883baa31a10ffc3d36ec278e5bf100b3bd"},{"author":{"_account_id":4715,"name":"Angus Salkeld","email":"asalkeld@redhat.com","username":"asalkeld"},"change_message_id":"1c5cbdfac98275b7404a322092d7fc1df95b7315","unresolved":false,"context_lines":[{"line_number":531,"context_line":""},{"line_number":532,"context_line":"    def update_alarm(self, alarm):"},{"line_number":533,"context_line":"        \"\"\"update alarm"},{"line_number":534,"context_line":"        If alarm.alarm_id is set then update, else insert."},{"line_number":535,"context_line":"        \"\"\""},{"line_number":536,"context_line":"        aid \u003d alarm.alarm_id"},{"line_number":537,"context_line":"        data \u003d alarm.as_dict()"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAOn%2F%2FmYo%3D","line":534,"in_reply_to":"AAAAOn%2F%2Fmjw%3D","updated":"2013-05-02 10:33:05.000000000","message":"In the later patch I check this in the api.\n if it is a PUT I make sure the alarm exists\n if it is a POST I clear the alarm_id so does not become an update","commit_id":"63a521883baa31a10ffc3d36ec278e5bf100b3bd"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"453fd36184cd1c2c610940c5ddb145b558251d95","unresolved":false,"context_lines":[{"line_number":542,"context_line":"                {\u0027$set\u0027: data},"},{"line_number":543,"context_line":"                upsert\u003dTrue)"},{"line_number":544,"context_line":"        else:"},{"line_number":545,"context_line":"            aid \u003d self.db.alarm.insert(data)"},{"line_number":546,"context_line":""},{"line_number":547,"context_line":"        stored_alarm \u003d self.db.alarm.find({\u0027_id\u0027: aid})[0]"},{"line_number":548,"context_line":"        stored_alarm[\u0027alarm_id\u0027] \u003d str(stored_alarm[\u0027_id\u0027])"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAOn%2F%2FmjU%3D","line":545,"updated":"2013-05-02 07:20:27.000000000","message":"We should manually set the \u0027_id\u0027 field to ObjectId().toString() in insertion, otherwise the insert operation will set the \u0027_id\u0027 to the ObjectID type, while we assume it is str type in udpate operation.","commit_id":"63a521883baa31a10ffc3d36ec278e5bf100b3bd"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"bbae71b6f4f75b72110359e9f58aeee913805e3e","unresolved":false,"context_lines":[{"line_number":542,"context_line":"                {\u0027$set\u0027: data},"},{"line_number":543,"context_line":"                upsert\u003dTrue)"},{"line_number":544,"context_line":"        else:"},{"line_number":545,"context_line":"            aid \u003d self.db.alarm.insert(data)"},{"line_number":546,"context_line":""},{"line_number":547,"context_line":"        stored_alarm \u003d self.db.alarm.find({\u0027_id\u0027: aid})[0]"},{"line_number":548,"context_line":"        stored_alarm[\u0027alarm_id\u0027] \u003d str(stored_alarm[\u0027_id\u0027])"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAOn%2F%2FmXE%3D","line":545,"in_reply_to":"AAAAOn%2F%2FmYY%3D","updated":"2013-05-02 10:43:11.000000000","message":"I tried \"insert\" first then \"update\", the result is 2 documents are in the alarm collection. One with the \u0027_id\u0027 of ObjectId, the other is the one with the \u0027id\u0027 of string.","commit_id":"63a521883baa31a10ffc3d36ec278e5bf100b3bd"},{"author":{"_account_id":4715,"name":"Angus Salkeld","email":"asalkeld@redhat.com","username":"asalkeld"},"change_message_id":"1c5cbdfac98275b7404a322092d7fc1df95b7315","unresolved":false,"context_lines":[{"line_number":542,"context_line":"                {\u0027$set\u0027: data},"},{"line_number":543,"context_line":"                upsert\u003dTrue)"},{"line_number":544,"context_line":"        else:"},{"line_number":545,"context_line":"            aid \u003d self.db.alarm.insert(data)"},{"line_number":546,"context_line":""},{"line_number":547,"context_line":"        stored_alarm \u003d self.db.alarm.find({\u0027_id\u0027: aid})[0]"},{"line_number":548,"context_line":"        stored_alarm[\u0027alarm_id\u0027] \u003d str(stored_alarm[\u0027_id\u0027])"}],"source_content_type":"text/x-python","patch_set":2,"id":"AAAAOn%2F%2FmYY%3D","line":545,"in_reply_to":"AAAAOn%2F%2FmjU%3D","updated":"2013-05-02 10:33:05.000000000","message":"I am not sure this is a problem. In the update() it is just a key/value search pair\nused to select the entry.","commit_id":"63a521883baa31a10ffc3d36ec278e5bf100b3bd"},{"author":{"_account_id":4491,"name":"Lianhao Lu","email":"llh_misc@outlook.com","username":"lianhao-lu"},"change_message_id":"a279e962f04608d19bcdde19c84af999bd2c6391","unresolved":false,"context_lines":[{"line_number":547,"context_line":"        stored_alarm \u003d self.db.alarm.find({\u0027_id\u0027: aid})[0]"},{"line_number":548,"context_line":"        stored_alarm[\u0027alarm_id\u0027] \u003d str(stored_alarm[\u0027_id\u0027])"},{"line_number":549,"context_line":"        del stored_alarm[\u0027_id\u0027]"},{"line_number":550,"context_line":"        return models.Alarm(**stored_alarm)"},{"line_number":551,"context_line":""},{"line_number":552,"context_line":"    def delete_alarm(self, alarm_id):"},{"line_number":553,"context_line":"        \"\"\"Delete a alarm"}],"source_content_type":"text/x-python","patch_set":5,"id":"AAAAOn%2F%2Fiog%3D","line":550,"updated":"2013-05-06 09:08:33.000000000","message":"I did the following test on update_alarm:\n\n1. inst \u003d update_alarm({\u0027key\u0027:\u0027value\u0027})\n2. inst.key \u003d \u0027value2\u0027\n3. update_alarm(inst)\n\nThis results 2 alarms stored in the DB instead of 1. One is with ObjectId object as its \u0027_id\u0027 and the other is with str object as its \u0027_id\u0027.","commit_id":"965ca3144833bdceabd069be2a68f112bae3d672"}]}
