전체 페이지뷰

2013년 7월 11일 목요일

mongodb db create & import

1. create DB

> use hasun 
switched to db hasun 
> db.addUser('admin', 'password');  
{  
    "user" : "admin",  
    "readOnly" : false,  
    "pwd" : "2fc061c4987d59a607e75512ec63e5db",  
    "_id" : ObjectId("512c10e37c67639f0584be7f")  
}  
> show dbs;  
admin   0.203125GB  
local   (empty)  
test    0.203125GB  
hasun 0.203125GB

> db.createCollection("collectionName");
> db.collectionName.drop();

2. mongodb import 

db.addUser({user:"hasun", pwd:"password", roles:["userAdmin"]})
db.createCollection("hasun");

mongoimport --host IP --port Port --db hasun --username admin --password password --collection collectionName --type csv --file tesst.csv --headerline


3. find reference Data
reference data URL : http://en.wikipedia.org/wiki/Latitude_and_longitude_of_cities,_A-H 
http://en.wikipedia.org/wiki/Latitude_and_longitude_of_cities,_I-P
http://en.wikipedia.org/wiki/Latitude_and_longitude_of_cities,_Q-Z




댓글 없음:

댓글 쓰기