如何使用php在表中显示MongoDB数据


How to show MongoDB data in a table using php

我正在用PHP查询MongoDB,我希望在一个表中显示一个集合的所有数据。

这是我回调数据的部分样本:

Array (
  [0] => Array (
  [transactions] => Array (
    [_id] => 729cfe7c462089e204000000
    [propertyId] => 729cfe01462089e104000000
    [chargedTo] => tenant
    [tenantId] => 729cfe5f462089c104000000
    [category] => rent
    [amount] => 1000
    [paymentMethod] => cheque
    [datedAt] => 2013-01-01
    [status] => paid
    [attachmentUrl] =>
    [attachmentName] =>
    [description] =>
    [emailTenant] => 0
    [paidAt] =>
    [createdAt] => 2013-03-23T00:49:48.350Z
    [accountId] => 729cfc194620897c03000000
    [alert] =>
    )
  )
[1] => Array (
  [transactions] => Array (
    [_id] => 729cfe93462089ea04000000
    [propertyId] => 729cfe01462089e104000000
    [chargedTo] => tenant
    [tenantId] => 729cfe5f462089c104000000
    [category] => rent
    [amount] => 5000
    [paymentMethod] => cheque
    [datedAt] => 2013-03-22
    [status] => paid
    [attachmentUrl] =>
    [attachmentName] =>
    [description] =>
    [emailTenant] => 0
    [paidAt] =>
    [createdAt] => 2013-03-23T00:49:48.350Z
    [accountId] => 729cfc194620897c03000000
    [alert] =>
    )
  )
  .
  .
  .
[n] => Array (
  [transactions] => Array (
    [_id] => 729cfea54620897c03000001
    [propertyId] => 729cfe01462089e104000000
    [chargedTo] => tenant
    [tenantId] => 729cfe5f462089c104000000
    [category] => rent
    [amount] => 2222
    [paymentMethod] => Paypal
    [datedAt] => 2013-03-05
    [status] => paid
    [attachmentUrl] =>
    [attachmentName] =>
    [description] =>
    [emailTenant] => 0
    [paidAt] =>
    [createdAt] => 2013-03-23T00:49:48.350Z
    [accountId] => 729cfc194620897c03000000
    [alert] =>
    )
  )
)

我如何得到所有这些数据显示在一个表在PHP?

<?php
$db = new Mongo();
$query = $db->dbname->collection->find();
echo '<pre>';
foreach ( $query as $current )
    print_r($current);
echo '</pre>';
?>