MongoDB + PHP: Delete a value of a sub array -


i have document in following form:

[uuid] => d030b8d1 [commentstrings] => array (     [0] => 1366220389#mac@test.org#test 1     [1] => 1366220422#mac@test.org#test 2     [2] => 1366220458#mac@test.org#test 3 ) 

i have full string of 1 of commentstrings , want delete value.

if try on cli, works:

 db.messages.update(      {'uuid':'d030b8d1'},       { $pull : {          'commentstrings': '1366220422#mac@test.org#test 2'      }}   ) 

but if try same in php nothing happens:

$response = $stdb->messages->update(     array('uuid'=>'d030b8d1'),     array('$pull' => array('commentstrings' => '1366220422#mac@test.org#test 2')) ); 

any idea, i'm doing wrong here?

i not behaviour:

$mongodb->ghghghg->insert(array('uuid' => 'd030b8d1',         'commentstrings' => array (             '1366220389#mac@test.org#test 1',             '1366220422#mac@test.org#test 2',             '1366220458#mac@test.org#test 3' )));  var_dump($mongodb->ghghghg->findone());  $response = $mongodb->ghghghg->update(         array('uuid'=>'d030b8d1'),         array('$pull' => array('commentstrings' => '1366220422#mac@test.org#test 2')) );  var_dump($mongodb->ghghghg->findone()); 

prints:

array   '_id' =>      object(mongoid)[19]       public '$id' => string '516ffff96803fa2261000000' (length=24)   'uuid' => string 'd030b8d1' (length=8)   'commentstrings' =>      array       0 => string '1366220389#mac@test.org#test 1' (length=30)       1 => string '1366220422#mac@test.org#test 2' (length=30)       2 => string '1366220458#mac@test.org#test 3' (length=30)  array   '_id' =>      object(mongoid)[18]       public '$id' => string '516ffff96803fa2261000000' (length=24)   'commentstrings' =>      array       0 => string '1366220389#mac@test.org#test 1' (length=30)       1 => string '1366220458#mac@test.org#test 3' (length=30)   'uuid' => string 'd030b8d1' (length=8) 

what version of driver on , php version?

also sure commentstrings array? in mongodb console, not through php , see print out like.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -