mongodb
[mongodb] collection의 스키마 보기
'김용환'
2016. 1. 22. 14:31
mongodb 3.x에서 collection shema를 보고 싶다면, getIndexes()를 호출하다. DB 세계의 describe table()과 비슷하다.
> db.google.getIndexes()
[
{
"v" : 1,
"key" : {
"_id" : 1
},
"name" : "_id_",
"ns" : "staticmap.google"
},
{
"v" : 1,
"key" : {
"expireAt" : 1
},
"name" : "expireAt_1",
"ns" : "staticmap.google",
"expireAfterSeconds" : 0
},
{
"v" : 1,
"key" : {
"placeId" : 1
},
"name" : "placeId",
"ns" : "staticmap.google"
}
]
참조
https://docs.mongodb.org/v3.0/reference/method/db.collection.getIndexes/