Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
MongoDB Modifier Operations
  • I can't seem to figure out how to do modifier operations with MongoDB. I've got a call like this:
    update('products', array('$push' => array('images' => array($image => $hash))))
    

    But this ends up creating an array called "$push" rather than performing a push operation. Does anyone know how I can do these? Thanks
  • Looks like there is a fourth, undocumented parameter in the update function $literal. Setting this to true will make it work as expected. When this is false, which is the default, it'll take your data array and use the $set operator on it. I guess it is trying to simplify things for the user by hiding the $set operation for you and make it work more like the update in the DB class, but it seems backwards to me.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion