FAQ
I try to execute update query for Mongo Db. I use php, and send values that
are going to be updated. I send date parameter in milliseconds. But it
didn't work. Here is the code;

function updateEventById($id1,$start,$end,$collection){
$this->collection = $this->database->$collection;

//$start=new MongoDate($start);

//$end=new MongoDate($end);

$newdata = array('$set' => array("start.sec" => $start,
"end.sec" => $end ));

$theObjId = new MongoId($id1["\$id"]);
$this->collection->update(array("_id" => $theObjId), $newdata);
}


--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongodb-user@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user+unsubscribe@googlegroups.com
See also the IRC channel -- freenode.net#mongodb

Search Discussions

  • Jorge Puente Sarrín at Dec 27, 2012 at 12:40 am
    Hi,

    I have answered this question on StackOverflow:
    http://stackoverflow.com/questions/14045947/mongodb-update-doesnt-work-for-date-in-php/14047270#14047270



    2012/12/26 Bugra Cakmak <bugracakmak@gmail.com>
    I try to execute update query for Mongo Db. I use php, and send values
    that are going to be updated. I send date parameter in milliseconds. But it
    didn't work. Here is the code;

    function updateEventById($id1,$start,$end,$collection){
    $this->collection = $this->database->$collection;

    //$start=new MongoDate($start);

    //$end=new MongoDate($end);

    $newdata = array('$set' => array("start.sec" => $start,
    "end.sec" => $end ));

    $theObjId = new MongoId($id1["\$id"]);
    $this->collection->update(array("_id" => $theObjId), $newdata);
    }


    --
    You received this message because you are subscribed to the Google
    Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com
    To unsubscribe from this group, send email to
    mongodb-user+unsubscribe@googlegroups.com
    See also the IRC channel -- freenode.net#mongodb


    --
    Jorge Puente Sarrín.

    --
    You received this message because you are subscribed to the Google
    Groups "mongodb-user" group.
    To post to this group, send email to mongodb-user@googlegroups.com
    To unsubscribe from this group, send email to
    mongodb-user+unsubscribe@googlegroups.com
    See also the IRC channel -- freenode.net#mongodb

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmongodb-user @
categoriesmongodb
postedDec 26, '12 at 9:59p
activeDec 27, '12 at 12:40a
posts2
users2
websitemongodb.org
irc#mongodb

People

Translate

site design / logo © 2022 Grokbase