Code:MongoDB und Twitter Array
$m = new MongoClient();
$db = $m->selectDB('twitter');
$collection = new MongoCollection($db, 'status');
$cursor = $collection->find();
foreach ($cursor as $document) {
echo $document['statuses'][0]['text'];
}
Array:
Array
(
[_id] => MongoId Object
(
[$id] => 123
)
[statuses] => Array
(
[0] => Array
(
[text] => Tweet no 1
)
[1] => Array
(
[text] => Tweet no 2
)
[1] => Array
(
[text] => Tweet no 3
)
)
)
Der Ausgang ist: Tweet no 1.
Wie bekomme ich den ganzen 'Text' Array? Es sollte stattdessen "Tweet Nr. 1, Nr. 2, Nr. 3" zurückgegeben werden.
Ich habe versucht echo $document['statuses']['text']
funktioniert aber nicht.