I tried to add two integer type columns to all the documents on one of my collections, so I used $addFields, my query is below:
db.test.aggregate([
{
$addFields:
{
"NumberOne": 0,
"NumberTwo": 0,
}
}
]
)
After I run the query, the two new columns were added as double type, 0.0 instead of int32 type 0. I tried to use updatemany to update the column with the following db.test.updateMany({}, {$set:{"NumberOne": 0}}) and still no help. How can I just add two new integer columns in mongodb? Thanks!