Understanding the JSON Results

The following document is returned from a search for a particular id.

{
    "retval":[
        {
            "_id":{
                "$oid":"4d49af7ce5397929bad5421e"
            }
            ,
            "a":{
                "b":"test",
                "c":"12345",
                "name":"bob"
            }
            ,
            "xml":{
                "_id":{
                    "$oid":"4d49af7ce5397929b8d5421e"
                }
                ,
                "chunkSize":262144,
                "length":80,
                "md5":"2fd2fece0f2c73ef073436d3e2638922",
                "filename":null,
                "contentType":"application/xml",
                "uploadDate":{
                    "$date":"2011-02-02T19:24:44Z"
                }
                ,
                "aliases":null
            }
        }
    ]
    ,
    "ok":1.0
}

The results of a search against the mongoDB are all returned in JSON format and are stored in the retval array. This array will contain multiple result objects if the search was not for a single id.

The JSON result also contains two additional keys. The first is the _id key, which is the unique id assigned by mongoDB to the record. The second is the xml key. The xml key stores reference information in the XML file in the GridFS system.


iWay Software