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

db.<collection>.save() cause data type mismatch

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.0.4
    • Component/s: Admin, JavaScript, Shell
    • None
    • ALL

      I have data imported using Mongo C# Driver, and at some point i noticed my link are generating certification error since they are not using SSL, so i had to update them somehow, i decide to add both version of links, so i had to update my data in place somehow, and the only way i could find was not update method, but looping through, modification, and save...

      In this process i didn't modified any data, or convert them to JSON, i just modified the required field, then when i start the project, i faced internal error for those updated users...

      The Int32 field somehow turned to Double, yet the Int64 was intact... i modified object created by DateTimeOffset, it creates an array with two item, an Int64, and an Int32....

      But the data type got messed with.

      db.humanResource.user.find({
      	ProfilePictures: {
      		$exists: true
      	},
      	ProfilePictures: {
      		$ne: null
      	}
      }).forEach(function (e, i) {
      	for(var i=0; i< e.ProfilePictures.length; i++){
      		 e.ProfilePictures[i].CloudinarySecureUrl = updateHttpToHttps(e.ProfilePictures[i].CloudinaryUrl);
      	}
      	db.humanResource.user.save(e);
      })

        1. Dumps.rar
          42 kB
          Hassan Faghihi

            Assignee:
            eric.sedor@mongodb.com Eric Sedor
            Reporter:
            deadmann Hassan Faghihi
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: