I am trying to append some string to a field's value using php and MongoDB, but am failing to do so. My code is as under:
$manager = new MongoDB\Driver\Manager("mongodb://localhost:27017");
$filter = ['_id' => new MongoDB\BSON\ObjectId($_POST['itemid'])];
$newObj = ['$set' => ["department" => $_POST['department'],
"subDepartment" => $_POST['subdepartment'],
"feedStatusDescription" => ['$concat' => ["$feedStatusDescription" , $_POST['description'] ]] ,
"feedStatus" => $_POST['feedStatus']
]
];
$options = ["multi" => true, "upsert" => false];
$bulk = new MongoDB\Driver\BulkWrite;
$bulk->update($filter, $newObj, $options);
try {
$result = $manager->executeBulkWrite("mydb.mycollection", $bulk, $wc);
} catch (MongoDB\Driver\Exception\Exception $e) {
echo $e->getMessage(), "\n";
}
Using this code I am able to update all of other fields except feedStatusDescription, any idea what is missing?
Thanks