์์
db.tel_pos.save( { mobile_no : "01038631858",
last_pos : [ [127.0945116,37.5353970],
[126.9815316,37.5685375],
[127.0305035, 37.5017141] ] } )
db.tel_pos.save( {mobile_no : "01075993678",
last_pos : [ [127.1353452,37.4576521],
[127.1359081,37.4512311],
[125.7823091, 36.3339801] ] })
db.tel_pos.save( {mobile_no : "01071229021",
last_pos : [ [126.3411234,36.1098761],
[124.3410922,37.3409901],
[127.2223331, 37.0912090] ] })
* ์ธ๋ฑ์ค ์์ฑ
db.tel_pos.ensureIndex( {last_pos : "2d" } )
* ํ์ธํ๊ธฐ
db.tel_pos.find( { last_pos : { $within : { $centerSphere :[[ 127.0352915,37.5360206 ],30/3963] }} }, {_id : 0, mobile_no : 1, last_pos :1 }).pretty()
* ์์
db.position.insert( { "_id" : "m239092" , "data_type" : NumberLong(1) , "loc" : { "type" : "Point", "coordinates" : [127.1058431, 37.516413] }, "pos_name" : ["name=์ ์ค์ญ 2ํธ์ ", "trans_type=์งํ์ฒ " ] })
db.position.insert( { "_id" : "m239091" , "data_type" : NumberLong(1) , "loc" : { "type" : "Point", "coordinates" : [127.0980748, 37.5301218] }, "pos_name" : ["name=๋์์ธ ํฐ๋ฏธ๋", "trans_type=๋ฒ์คํฐ๋ฏธ๋" ] })
db.position.insert( { "_id" : "m239090" , "data_type" : NumberLong(1) , "loc" : { "type" : "Point", "coordinates" : [127.0952154, 37.5398467] }, "pos_name" : ["name=๊ฐ๋ณ์ญ 2ํธ์ ", "trans_type=์งํ์ฒ " ] })
db.position.insert( { "_id" : "m239089" , "data_type" : NumberLong(1) , "loc" : { "type" : "Point", "coordinates" : [127.0742172, 37.5419541] }, "pos_name" : ["name=๊ฑด๊ตญ๋ํ์ญ 2ํธ์ ", "trans_type=์งํ์ฒ " ] })
db.position.createIndex({loc:"2dsphere"})
=> ์ธ๋ฑ์ค ์์ฑ
'db' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
mysql migration (0) | 2021.03.16 |
---|---|
mongodb mysql query๋ฌธ ๋น๊ต (0) | 2021.03.01 |
robo / mongodb ์ฐ๊ฒฐ (0) | 2021.03.01 |
mongoDB ํ์ฉํ๊ธฐ(CRUD) (0) | 2021.02.27 |
MySQL ์ค๋ฅ๋ฉ์์ง (0) | 2020.11.09 |