I am trying to add a new field productFiles(along with its field) to an existing document in MongoDb. But I am getting follwing error:
"the positional operator did not find the match needed from the query."
query := bson.M{
"productId": productId,
}
update := bson.M{
"$set": bson.M{
"productFiles.$.updatedOn": int32(time.Now().Unix()),
"productFiles.$.updatedBy": userId,
},
}
err := repo.Collection().Update(query, update)