code: private DBObject parseObject(TableDefinition tableDef, UNode docNode) {
          assert tableDef != null;
          assert docNode != null;
          assert docNode.getName().equals("doc");
          
          // Create the DBObject that we will return and parse the child nodes into it.
          DBObject dbObj = new DBObject();
          for (UNode childNode: docNode.getMemberList()) {
              // Extract field name and characterize what we expect.
              String fieldName = childNode.getName();
              FieldDefinition fieldDef = tableDef.getFieldDef(fieldName);
              boolean isLinkField = fieldDef == null ? false : fieldDef.isLinkField();
              boolean isGroupField = fieldDef == null ? false : fieldDef.isGroupField();
              boolean isCollection = fieldDef == null ? false : fieldDef.isCollection();
              Utils.require(!isGroupField,    // we currently don't expect group fields in query results
                            "Unexpected group field in query results: " + fieldName);
              
              // Parse value based on what we expect.
              if (isLinkField) {
                  parseLinkValue(dbObj, childNode, fieldDef);
              } else if (isCollection) {
                  parseMVScalarValue(dbObj, childNode, fieldDef);
              } else {
                  // Simple SV scalar value.
                  Utils.require(childNode.isValue(),
                                "Value of an SV scalar must be a value: " + childNode);
                  dbObj.addFieldValue(fieldName, childNode.getValue());
              }
          }
          
          // Our object is complete
          return dbObj;
      }
docs: than the perspective table of the query.