First, find the container that runs your MongoDB and ssh into it.
Then, find the collection you want to export:
mongo
show dbs
use <database>
show collections
exit| module ActiveRecordExtension | |
| extend ActiveSupport::Concern | |
| module ClassMethods | |
| # Simple left join taking advantage of existing Rails & Arel code | |
| def left_joins(*args) | |
| inner_joins = self.joins(*args).arel.join_sources | |
| left_joins = inner_joins.map do |join| | |
| Arel::Nodes::OuterJoin.new(join.left, join.right) | |
| end |
| # Here's a contrived example of a LEFT JOIN using ARel. This is an example of | |
| # the mechanics, not a real-world use case. | |
| # NOTE: In the gist comments, @ozydingo linked their general-purpose ActiveRecord | |
| # extension that works for any named association. That's what I really wanted! | |
| # Go use that! Go: https://gist.github.com/ozydingo/70de96ad57ab69003446 | |
| # == DEFINITIONS | |
| # - A Taxi is a car for hire. A taxi has_many :passengers. | |
| # - A Passenger records one person riding in one taxi one time. It belongs_to :taxi. |
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
First, find the container that runs your MongoDB and ssh into it.
Then, find the collection you want to export:
mongo
show dbs
use <database>
show collections
exit| # Generated by Percona Configuration Wizard (http://tools.percona.com/) version REL5-20120208 | |
| [mysql] | |
| # CLIENT # | |
| port = 3306 | |
| socket = /var/lib/mysql/data/mysql.sock | |
| [mysqld] |
Задание
Реализовать на Ruby с использованием Rails приложение со следующим функционалом:
Требования