2014年2月7日、OSS推進フォーラム クラウド技術部会にて発表したMongoDBの入門プレゼンです。

Ubuntu Karmic (9.10) で MongoDB + mongoid を使って簡単な Rails アプリケーションを作ってみました。 MongoDB とは、最近注目を集めつつあるドキュメント指向データベースの一種。mongoid は MongoDB にアクセスするための RubyGems。 参考資料: http://www.mongodb.org/display/DOCS/Ubuntu+and+Debian+packages http://mongoid.org/docs/installation 次の行を /etc/apt/sources.list の末尾に追加 deb http://downloads.mongodb.org/distros/ubuntu 9.10 10gen aptitude で MongoDB をインストール。 % sudo aptitude updat
まずは、インストールの解説です。 $ gem install mongoid --pre Rails3 対応の最新版は執筆時点で 2.0.0.beta.16 で、ベータ版なので、--pre オプションを使ってインストールします。2.0.0 リリースの際には、--pre を取って下さい。 そして、mongo ドライバー自体のパフォーマンスを上げるために、bson_ext をインストールしましょう。 $ gem install bson_ext bson_ext には、boost が必要です。MongoDB のインストール時にインストールされていると思いますので、問題ないと思います。もし、インストールできなくても動きますので、気にしないで下さい。 Rails 3 でのインストール Rails3 は Bundler を使用しており、必要な Gem を、Gemfile というファイルに書くことにな
mongoHQのプランアップデートの際にバックアップとインポートを使うことになったので、少しまとめる。 mongodumpとmongorestoreを使ったので表現があれかもしれないですが、初心者のあれでだれかつこんでください。 https://devcenter.heroku.com/articles/mongohq てかmongoHQのプランアップデートはまってたけど。よく読むと最後に Upgrading your Database ってあるし。。 流れとしては、ここの通り。 $ heroku maintenance:on (off) やるときは、これでdbに変更がないようにmaintenanceモードにしといたほうがいいねってかいてある。んでまず $heroku config MONGOHQ_URL: mongodb:// <username>:<password>@<host>:<
Heroku のアドオンに MongoHQ がある。16 MByte までではあるが、無料で MongoDB が使用できる。今回コレを初めて使用した。そのときのメモ。Mongoid 使用。 Herokuの設定 % heroku stack:migrate bamboo-mri-1.9.2 % heroku addons:add mongohq:free Mongoid 設定ファイル作成 config/initializers/mongoid.rb を作成。Rails のディレクトリ構成をパクパク。自動的に読み込まれるわけではないので自分で読み込むコードを書く必要あり。設定ファイルに切り出した理由は、cronを使うから。cron で行う処理でも MongoHQ に接続させる必要があるので。 require 'mongoid' Mongoid.configure do |config| if
The document describes MongoDB's GridFS specification for storing and retrieving files that exceed the BSON document size limit of 16MB. It explains that GridFS splits files into chunks, which are stored as individual documents, and maintains metadata about the file such as length, MD5, and filename in a separate collection. It provides examples of using the mongofiles command line tool to list, s
The document demonstrates various geospatial queries in MongoDB including indexing locations, saving a document with a location, and queries to find documents within a distance, box, or circle of a point. It shows how to find the nearest document to a point, limit the maximum distance, and use spherical geometry for more accurate distance calculations over large areas.
The document provides a comprehensive guide on setting up and using NoSQL systems, specifically MongoDB, with instructions for configuring replication sets, sharding, and managing data. It includes code snippets for commands to initialize master and slave configurations, as well as commands to add shards and enable sharding for collections. Additionally, there are examples of geospatial queries an
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く