mongoid 多库

#coding:utf-8
class Phone
  include Mongoid::Document
  set_database :phone


end


config:
defaults: &defaults
  host: 127.0.0.1
development:
  <<: *defaults
  database: person_data
  databases:
      spider:
        database: person_data
        host: 127.0.0.1
        port: 27017
      phone:
        database: social_data
        host: 127.0.0.1
        port: 27017


production:
  <<: *defaults
  database: person_data
  databases:
      spider:
        database: person_data
        host: 127.0.0.1
        port: 27017
      phone:
        database: social_data
        host: 127.0.0.1
        port: 27017

你可能感兴趣的:(mongoid)