Skip to content

Incorrect saving of data #28

@simoncoulton

Description

@simoncoulton

When attempting to save a simple array in the example below the wrong data is returned from the query. While it displays fine in MongoHub (in the Find tab), retrieving the data from either the console or the PHP driver returns only the first index from an array. If the resulting document contains multiple array objects, then only the first index from all arrays will be shown. This caused me a good hour or two's headache today, and resulted in me going back to the console for all my managing of data, which is a shame as MongoHub is the only native MongoDB GUI (and the PHP based ones just don't cut it).

Saving the following object to the data through the insert tab

{"parts": [1,2,3,4]}

Expected result from db.things.find()

{ "_id" : ObjectId("4f5890ff624df1578936963c"), "parts" : [ 1,2,3,4 ] }

Actual result

{ "_id" : ObjectId("4f5890ff624df1578936963c"), "parts" : [ NumberLong(4) ] }

which translates to this in php

[ 
"_id" => "4f5890ff624df1578936963c", 
"parts" => [ 1 ]
]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions