MongoDb只使用php获取值而不是键

时间:2016-01-27 12:47:07

标签: php json mongodb key

我正在使用mongodb,我的查询只返回一个键值 以下是var_dump

的格式
 <pre>array (size=471)
  0 => 
    array (size=1)
      'sno' => string '162230' (length=6)
  1 => 
    array (size=1)
      'sno' => string '165333' (length=6)
  2 => 
    array (size=1)
      'sno' => string '181312' (length=6)
  3 => 
    array (size=1)
      'sno' => string '181313' (length=6)
  4 => 
    array (size=1)
      'sno' => string '181314' (length=6)
  5 => 
    array (size=1)
      'sno' => string '181315' (length=6)
  6 => 
    array (size=1)
      'sno' => string '181316' (length=6)
  7 => 
    array (size=1)
      'sno' => string '181317' (length=6)
  8 => 
    array (size=1)
      'sno' => string '181318' (length=6)
  9 => 
    array (size=1)
      'sno' => string '181319' (length=6)
  10 => 
    array (size=1)
      'sno' => string '181320' (length=6)</pre>

我不想要钥匙。我想要的是一个没有循环的值数组。

1 个答案:

答案 0 :(得分:1)

解决了它。

<xp:this.converter>
    <xp:customConverter>
        <xp:this.getAsString><![CDATA[#{javascript:
            value.toFixed(0).replace(/(\d)(?=(\d{3})+(?!\d))/g, "$1 ") + " kr"
            }]]></xp:this.getAsString>
        <xp:this.getAsObject><![CDATA[#{javascript:
            parseFloat(value.replace(" ", ""))
            }]]></xp:this.getAsObject>
    </xp:customConverter>
</xp:this.converter>