Beispiel #1
0
 public static function bsonSerialize($item, $tag, $flags)
 {
     if ($tag === 'DateTime') {
         return \mongo\type\DateTime::fromString($item);
     } elseif ($tag === 'Timestamp') {
         return \mongo\type\Timestamp::fromString($item);
     } elseif ($tag === 'ObjectID') {
         return new \MongoDB\BSON\ObjectID($item);
     } elseif ($tag === 'Binary') {
         return \mongo\type\Binary::bsonImport($item);
     } elseif ($tag === 'Javascript') {
         return \mongo\type\Javascript::bsonImport($item);
     } elseif ($tag === 'Regex') {
         return \mongo\type\Regex::bsonImport($item);
     } elseif ($tag === 'MaxKey') {
         return new \MongoDB\BSON\MaxKey();
     } elseif ($tag === 'MinKey') {
         return new \MongoDB\BSON\MinKey();
     }
 }