vendredi 31 juillet 2015

MongoDB how do I get the schema from schemaless?

I am recieving a JSON object into mongodb

$instagram->setAccessToken($_SESSION['InstagramAccessToken']);
$popular = $instagram->getPopularMedia();
var_dump($popular);
$conn = new MongoClient('mongodb://localhost/?w=1');
$db = $conn->instagram;
$collection = $db->instagram1;
$collection->insert($popular);

No errors and I can see the data in the collection

But when I google how to see the layout, the samples given don't seem to work for me.

var myvar = db.instagram1.findOne();
for (var key in myvar){print (key);}
_id
foo
bar

mongo session output

I am a mongo n00b (mysql defector)

var_dump() output (raw object data)

how do I get a printout of the column headings and attributes associated with my imported JSON data? (the schema for the schemaless?)

Aucun commentaire:

Enregistrer un commentaire