Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

handle users

  • Loading branch information...
commit 5544579467ee69dae8c495c040c9b6682bd2e4fe 1 parent 1584a88
@benwyrosdick benwyrosdick authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 lib/heroku/command/mongo.rb
View
12 lib/heroku/command/mongo.rb
@@ -26,6 +26,8 @@ def transfer(from, to)
dest = make_connection(to)
origin.collections.each do |col|
+ next if col.name =~ /^system\./
+
display "Syncing #{col.name} (#{col.size})...", false
dest.drop_collection(col.name)
dest_col = dest.create_collection(col.name)
@@ -34,6 +36,16 @@ def transfer(from, to)
end
display " done"
end
+
+ display "Syncing users..."
+ dest_user_col = dest.collection('system.users')
+ origin_user_col = origin.collection('system.users')
+ dest_user_col.find().each do |user|
+ dest.remove_user(user['user'])
+ end
+ origin_user_col.find().each do |user|
+ dest_user_col.insert user
+ end
end
def heroku_mongo_uri
Please sign in to comment.
Something went wrong with that request. Please try again.