Created
August 23, 2012 03:23
-
-
Save sunny0425/3431858 to your computer and use it in GitHub Desktop.
batch insert by Mongoid (from http://stackoverflow.com/questions/3772378/batch-insert-update-using-mongoid)
This file contains hidden or 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
batch = [{:name => "mongodb"}, {:name => "mongoid"}] | |
Article.collection.insert(batch) | |
# my example | |
batch = [{ :name => '最高权限管理员', :level => DbRole::SuperAdmin }, { :name => '内容管理员', :level => DbRole::ContentAdmin }, { :name => '普通用户', :level => DbRole::NormalUser }] | |
DbRole.collection.insert(batch) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment