Permalink
Browse files

Swapped type and bin data when logging MongoBinData in the profiler.

  • Loading branch information...
1 parent 8e69509 commit 951b133dfd59092e7ad6010920c89947b724472c Brian Feaver committed Mar 15, 2013
Showing with 2 additions and 5 deletions.
  1. +1 −1 DataCollector/PrettyDataCollector.php
  2. +1 −4 Tests/DataCollector/PrettyDataCollectorTest.php
View
2 DataCollector/PrettyDataCollector.php
@@ -216,7 +216,7 @@ private function bsonEncode($query, $array = true)
} elseif ($value instanceof \MongoMaxKey) {
$formatted = 'new MaxKey()';
} elseif ($value instanceof \MongoBinData) {
- $formatted = 'new BinData("'.base64_encode($value->bin).'", "'.$value->type.'")';
+ $formatted = 'new BinData('.$value->type.', "'.base64_encode($value->bin).'")';
} elseif ($value instanceof \MongoGridFSFile || $value instanceof GridFSFile) {
$formatted = 'new MongoGridFSFile("'.$value->getFilename().'")';
} elseif ($value instanceof \stdClass) {
View
5 Tests/DataCollector/PrettyDataCollectorTest.php
@@ -36,20 +36,17 @@ public function testCollect($query, $formatted)
public function getQueries()
{
return array(
- // batchInsert
'batch insert' => array(
array('db' => 'foo', 'collection' => 'bar', 'batchInsert' => true, 'num' => 1, 'data' => array('foo' => 'bar'), 'options' => array()),
array('use foo;', 'db.bar.insert({ "foo": "bar" });'),
),
- // find
'find' => array(
array('db' => 'foo', 'collection' => 'bar', 'find' => true, 'query' => array('foo' => null), 'fields' => array()),
array('use foo;', 'db.bar.find({ "foo": null });'),
),
- // bin data
'bin data' => array(
array('db' => 'foo', 'collection' => 'bar', 'update' => true, 'query' => array('_id' => 'foo'), 'newObj' => array('foo' => new \MongoBinData('junk data'))),
- arraY('use foo;', 'db.bar.update({ "_id": "foo" }, { "foo": new BinData("' . base64_encode('junk data') . '", "2") });'),
+ arraY('use foo;', 'db.bar.update({ "_id": "foo" }, { "foo": new BinData(2, "' . base64_encode('junk data') . '") });'),
)
);
}

0 comments on commit 951b133

Please sign in to comment.