public function write($sid, /*string*/ $data)
    {
        //update/insert our session data
        if (!$this->sessionDoc) {
            $this->sessionDoc = array();
            $this->sessionDoc['_id'] = $sid;
            $this->sessionDoc['started'] = new MongoDate();
        }

        //there could have been a session regen so we need to be careful with the $sid here and set it anyway
        if ($this->sid != $sid) {
            //need to unlock old sid
            $this->unlock($this->sid);

            //set the new one
            $this->sid = $sid;
            $this->lock($this->sid);//@TODO shouldn't we try to see if this succeeded first?

            //and also make sure we're going to write to the correct document
            $this->sessionDoc['_id'] = $sid;
        }

        $this->sessionDoc['last_accessed'] = new MongoDate();
        $this->sessionDoc['data'] = new MongoBinData($data, MongoBinData::BYTE_ARRAY);

        $this->sessions->save($this->sessionDoc, $this->getConfig('write_options'));

        return true;
    }