0

I want to change a field type on mongodb for a collection from BsonBinary to ObjectId I wonder what is the query I should use to convert that field ?

By mongodb shell

db.company.updateMany({}, {????})

enter image description here

I tried unset then set but still not working

enter image description here

amorenew
  • 10,760
  • 10
  • 47
  • 69

1 Answers1

0

Make a new field which type is ObjectId then fill it by the String field then delete String field for all and rename the new field to the String field name

amorenew
  • 10,760
  • 10
  • 47
  • 69