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 +4 -4
- data/README.md +5 -6
- data/lib/mongo/util/version.rb +1 -1
- data/lib/mongo/util.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e49245d95c307faf9672a8691c76a714d5e46d5
|
4
|
+
data.tar.gz: f0d3d0df50728e6945c1b555159110e13f68725e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
#
|
52
|
-
mongo.
|
49
|
+
# Restore & clean up dump folder
|
50
|
+
mongo.restore!
|
51
|
+
mongo.clean!
|
53
52
|
end
|
54
53
|
|
55
54
|
```
|
data/lib/mongo/util/version.rb
CHANGED
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 @
|
73
|
+
# Returns Array of all collection-names of @from{database}
|
74
74
|
def collections
|
75
|
-
unless @
|
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 #{@
|
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(@
|
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.
|
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.
|
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
|