mongo-util 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eeff00079c9c0013854fbf1b2c7f9cf5a8bc5d91
4
- data.tar.gz: 5ab720e672d8029799ca498d119b2da13ed8a0e3
3
+ metadata.gz: 0e49245d95c307faf9672a8691c76a714d5e46d5
4
+ data.tar.gz: f0d3d0df50728e6945c1b555159110e13f68725e
5
5
  SHA512:
6
- metadata.gz: 6a81f03ba69da8d1056e9a0a2a020e4b0adfa8ee2ae1b1e3dc4d2afcdec8e0119aa0832b350697ce600fdecc6229b6e11827f49ae25be39783bd221f8d3aaf95
7
- data.tar.gz: 5ffaa9db865fceb403b8c389e3716df90b0a0f101eb28f1446e7352f5762a7b18c4801ec3b98a5725231a1a9e2ed16a23c92c2b4c00ffe1aa6def250a08bbccf
6
+ metadata.gz: 9ff94b13313b478e307f682eb0981105f7780d75cf07d92c4e5ee3899c364a738d70b795474537f8d74c06727d708bff01ca489ce2f48a1ec13500800ce08e91
7
+ data.tar.gz: f0c8158edb4486932f1184e1270fa08adc75c6c9ce11698f3248b5183d636b4fdd901d5c6661aab45519a1e2108abd21f174d2a7c4d71c5ad57a2e74a0be06c1
data/README.md CHANGED
@@ -35,21 +35,20 @@ mongo.collections.each do |collection|
35
35
  if collection == 'some.collection'
36
36
 
37
37
  # Add queries here as you like
38
- mongo.remove(collection, query: { something: false })
38
+ mongo.remove!(collection, query: { something: false })
39
39
  mongo.dump(collection: collection, query: { something: false })
40
- mongo.restore
41
40
 
42
41
  else
43
42
 
44
43
  # Just copy
45
- mongo.remove(collection)
44
+ mongo.remove!(collection)
46
45
  mongo.dump(collection: collection)
47
- mongo.restore
48
46
 
49
47
  end
50
48
 
51
- # Clean up dump folder
52
- mongo.clean
49
+ # Restore & clean up dump folder
50
+ mongo.restore!
51
+ mongo.clean!
53
52
  end
54
53
 
55
54
  ```
@@ -1,5 +1,5 @@
1
1
  module Mongo
2
2
  module Util
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
data/lib/mongo/util.rb CHANGED
@@ -70,15 +70,15 @@ module Mongo
70
70
  self.exec(cmd)
71
71
  end
72
72
 
73
- # Returns Array of all collection-names of @to{database}
73
+ # Returns Array of all collection-names of @from{database}
74
74
  def collections
75
- unless @to[:host] && @to[:port] && @to[:db]
75
+ unless @from[:host] && @from[:port] && @from[:db]
76
76
  raise 'Cannot fetch collections: needs @to[:host], @to[:port], @to[:db]'
77
77
  end
78
78
 
79
- cmd = "mongo #{@to[:db]} --host #{@to[:host]} --port #{@to[:port]} --quiet --eval 'db.getCollectionNames()'"
79
+ cmd = "mongo #{@from[:db]} --host #{@from[:host]} --port #{@from[:port]} --quiet --eval 'db.getCollectionNames()'"
80
80
  # Append auth, if neccessary
81
- cmd += Mongo::Util.authentication(@to)
81
+ cmd += Mongo::Util.authentication(@from)
82
82
 
83
83
  collections = self.exec(cmd, return_output: true).rstrip.split(',')
84
84
  # If we have a '{' in the output, Mongo has thrown an error
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongo-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Finn-Lenanrt Heemeyer
@@ -57,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
57
  version: '0'
58
58
  requirements: []
59
59
  rubyforge_project:
60
- rubygems_version: 2.3.0
60
+ rubygems_version: 2.0.14
61
61
  signing_key:
62
62
  specification_version: 4
63
63
  summary: Ruby Interface for copying Mongo Collections from one server to another