Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
MongoDB Json Response ID Object
  • Hi, I've been on the Mongo group and chat and this is coming back to Fuel. 

    If I do:
    Mongo_Db::instance()->where(array('_id' => new MongoId($id)));
    $result = Mongo_Db::instance()->get(self::MY_COLLECTION);

    I get (for example):
    {"_id":{"$id":"520a9f73dc33ef0512000000"}}
    According to mongo, $id should be $oid. 
    Besides that though, what methods can I use to get/set these?
    I am building a REST service and my client shouldn't really have to know about 
    these Objects.
  • HarroHarro
    Accepted Answer
    Better pop into #fuelphp on IRC and see if you can get hold of someone, I haven't used Mongo_Db.

    A get() runs:

    $documents = $this->db->{$collection}->find($this->wheres, $this->selects)->limit((int) $this->limit)->skip((int) $this->offset)->sort($this->sorts);

    so nothing magical.

Howdy, Stranger!

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

In this Discussion