Currently i run a mongo query that looks similar to the following:
$query = array(
\'user_id\' => $this->getUserId(),
\'name\' => $this->g
This is because of your $query
value. It is a common beginner mistake.
Placing a whole query document into update like so:
$query = array(
'user_id' => $this->getUserId(),
'name' => $this->getName()
);
Without any operators will actually REPLACE the original document with this one.
Instead to $set
those fields to a new value you should use $set
:
$query = array('$set' => array(
'user_id' => $this->getUserId(),
'name' => $this->getName() )
);
This should give you the effect you desire.