0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MongoDB学習日記 - 2019/12/09

0
Posted at

目的

Herokuで作ったMongoDBで

  1. DB作成
  2. テーブル作成
  3. CLIでDBに接続

DB作成

$ heroku addons:create mongolab -a docomo-cycle-book

テーブル作成

Admin UIをアクセスして、DBユーザ、テーブル、テストデータ等が作成できる;

$ heroku addons:open mongolab

CLIでDBに接続

まず、上記のAdmin UIで接続URIを取得

$ mongo mongodb://<user>:<password>@ds253428.mlab.com:53428/heroku_c3swt6jb

DBを操作するコマンドはこれで分かる

rs-ds253428:PRIMARY> db.help()

例えば、検索はこんな感じ

rs-ds253428:PRIMARY> db.parking_lot.find({"id": "10150"})
{ "_id" : ObjectId("5dee642b7c213e7f195d053a"), "id" : "10150", "name" : "C5-07.港区立港南図書館", "ParkingEntID" : "TYO", "ParkingLat" : "35.632842", "ParkingLon" : "139.749500" }

データは上記のようなJSON文字列であり、
filed Nameも、field valueも""で囲まれることが必要;
:マークの後はスペースが必要;

References

Description URL
homepage of mLab MongoDB addon click me
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?