mongofill / mongofill-hhvm

A mix of the original Mongofill extension + BSON implementation in C++
MIT License
32 stars 19 forks source link

Inserting an empty #40

Closed gui-com-pt closed 9 years ago

gui-com-pt commented 9 years ago

I'm trying to insert a document having an empty array. It's inserted as an empty object.

$m = new MongoClient('mongodb://localhost/testdbb');
$db = $m->db;
$obj = array('name' => 'asd', 'emptyArray' => array());
$res = $db->test->insert($obj);

The result:

{
    "name" : "asd",
    "emptyArray" : {},
    "_id" : ObjectId("559c3be4049f20b32a9dface")
}

Should'nt emptyArray be an array instead of an Object?

bogomips commented 9 years ago

I had same problem and I used array(array()), but it's obviously a workaround

mcuadros commented 9 years ago

can you post this issue at https://github.com/mongofill/mongofill?