Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-4233

corruption during '$set' operation

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Blocker - P1 Blocker - P1
    • 1.8.5
    • 1.8.4
    • Write Ops
    • None
    • Linux
    • ALL

    Description

      Let's assume we have the following record

      > db.users.findOne()
      {
      	"_id" : ObjectId("4e2f0a99a26037e417000056"),
      	"info" : {
      		"Qu" : {
      			"start" : "1320021626",
      			"stop" : 1320779121
      		},
      		"Se" : {
      			"start" : 1320021628,
      			"stop" : 1320779121
      		},
      		"Se I" : {
      			"start" : "1320021629",
      			"stop" : 1320779121
      		},
      		"Se I_Se M" : {
      			"start" : "1320021635",
      			"stop" : 1320779121
      		},
      		"Se M" : {
      			"start" : "1320021639",
      			"stop" : 1320779121
      		},
      		"So" : {
      			"start" : "1320021641",
      			"stop" : 1320779121
      		}
      	}
      }

      and update it with the following code

      > db.users.update({'_id':ObjectId('4e2f0a99a26037e417000056')},{'$set':{'info.Qu.start':'a', 'info.Se.start':'a', 'info.Se I.start':'a', 'info.Se I_Se M.start' : 'a', 'info.Se M.start':'a', 'info.So.start':'a'}})

      Everything seems to work out ok, but info.Se actually was not updated but duplicated !

      > db.users.findOne()
      {
      	"_id" : ObjectId("4e2f0a99a26037e417000056"),
      	"info" : {
      		"Qu" : {
      			"start" : "a",
      			"stop" : 1320779121
      		},
      		"Se" : {
      			"start" : 1320021628,
      			"stop" : 1320779121
      		},
      		"Se I" : {
      			"start" : "a",
      			"stop" : 1320779121
      		},
      		"Se I_Se M" : {
      			"start" : "a",
      			"stop" : 1320779121
      		},
      		"Se M" : {
      			"start" : "a",
      			"stop" : 1320779121
      		},
      		"Se" : {
      			"start" : 1320021628,
      			"stop" : 1320779121
      		},
      		"So" : {
      			"start" : "a",
      			"stop" : 1320779121
      		}
      	}
      }
      > db.users.findOne({},{'info.Se':1})
      {
      	"_id" : ObjectId("4e2f0a99a26037e417000056"),
      	"info" : {
      		"Se" : {
      			"start" : 1320021628,
      			"stop" : 1320779121
      		},
      		"Se" : {
      			"start" : 1320021628,
      			"stop" : 1320779121
      		}
      	}
      }
       

      Attachments

        1. bug.js
          0.9 kB

        Activity

          People

            aaron Aaron Staple
            dominik Dominik Gehl
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: