Hi,
I have an issue, \DB\Mongo\Mapper is inserting new recored instead of updating current record.
I followed these instructions.
https://fatfreeframework.com/3.6/mongo-mappermyclass.php
<?php
namespace Model;
class MyClass extends \DB\Mongo\Mapper {
public $transid, $tempStatus;
public function __construct() {
parent::__construct( \Base::instance()->get('MongoDB'), 'transactions' );
}
private function myFunction($dataArr){
$this->transid = new \MongoId($dataArr['id']); // $dataArr['id'] = 58f3f0a28e5bbfb808bf6784
$dataFound=$this->load(array('_id'=>$this->transid));
if (empty($dataFound))
continue;
if($dataFound->status)
$this->tempStatus = $dataFound->status;
$this->resolved = '1';
$this->approvedBy ='1';
$this->status = (string)$this->tempStatus;
if($res = $this->update()){
echo "After Updated<pre>";
print_r($res);
}
}
}