Created
April 8, 2015 02:50
-
-
Save kyanny/f767f34bd19d6318ca15 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'mongo_mapper' | |
MongoMapper.database = 'testing' | |
class User | |
include MongoMapper::Document | |
end | |
class Bookmark | |
include MongoMapper::Document | |
belongs_to :user | |
ensure_index :user_id | |
end | |
class Tag | |
include MongoMapper::Document | |
belongs_to :user | |
belongs_to :bookmark | |
ensure_index :user_id | |
ensure_index :bookmark_id | |
ensure_index :user_id => Mongo::ASCENDING, :bookmark_id => Mongo::ASCENDING | |
end | |
require 'pp' | |
pp User.collection.index_information | |
pp Bookmark.collection.index_information | |
pp Tag.collection.index_information |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment