mongo-util 0.0.4 → 0.0.5
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 +7 -7
- data/lib/mongo/util.rb +6 -4
- data/lib/mongo/util/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eeff00079c9c0013854fbf1b2c7f9cf5a8bc5d91
|
4
|
+
data.tar.gz: 5ab720e672d8029799ca498d119b2da13ed8a0e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a81f03ba69da8d1056e9a0a2a020e4b0adfa8ee2ae1b1e3dc4d2afcdec8e0119aa0832b350697ce600fdecc6229b6e11827f49ae25be39783bd221f8d3aaf95
|
7
|
+
data.tar.gz: 5ffaa9db865fceb403b8c389e3716df90b0a0f101eb28f1446e7352f5762a7b18c4801ec3b98a5725231a1a9e2ed16a23c92c2b4c00ffe1aa6def250a08bbccf
|
data/README.md
CHANGED
@@ -35,17 +35,17 @@ mongo.collections.each do |collection|
|
|
35
35
|
if collection == 'some.collection'
|
36
36
|
|
37
37
|
# Add queries here as you like
|
38
|
-
mongo.
|
39
|
-
mongo.
|
38
|
+
mongo.remove(collection, query: { something: false })
|
39
|
+
mongo.dump(collection: collection, query: { something: false })
|
40
40
|
mongo.restore
|
41
|
-
|
41
|
+
|
42
42
|
else
|
43
|
-
|
43
|
+
|
44
44
|
# Just copy
|
45
|
-
mongo.
|
46
|
-
mongo.
|
45
|
+
mongo.remove(collection)
|
46
|
+
mongo.dump(collection: collection)
|
47
47
|
mongo.restore
|
48
|
-
|
48
|
+
|
49
49
|
end
|
50
50
|
|
51
51
|
# Clean up dump folder
|
data/lib/mongo/util.rb
CHANGED
@@ -41,7 +41,8 @@ module Mongo
|
|
41
41
|
end
|
42
42
|
|
43
43
|
# Restore contents of @dump_dr to @to{database}
|
44
|
-
|
44
|
+
# NOTE: Changes @to{database}
|
45
|
+
def restore!
|
45
46
|
unless @to[:host] && @to[:port] && @to[:db] && @from[:db]
|
46
47
|
raise 'Cannot restore: needs @to[:host], @to[:port], @to[:db] & @from[:db]'
|
47
48
|
end
|
@@ -54,8 +55,9 @@ module Mongo
|
|
54
55
|
end
|
55
56
|
|
56
57
|
# Removes all items / items which match options[:query]
|
57
|
-
# from collection
|
58
|
-
|
58
|
+
# from collection of @from{database}
|
59
|
+
# NOTE: Changes @from{database}
|
60
|
+
def remove!(collection, options={})
|
59
61
|
unless @to[:host] && @to[:port] && @to[:db]
|
60
62
|
raise "Cannot remove #{collection}: needs @to[:host], @to[:port], @to[:db]"
|
61
63
|
end
|
@@ -84,7 +86,7 @@ module Mongo
|
|
84
86
|
end
|
85
87
|
|
86
88
|
# Deletes @dump_dir
|
87
|
-
def clean
|
89
|
+
def clean!
|
88
90
|
self.exec("rm -rf #{@dump_dir}")
|
89
91
|
end
|
90
92
|
|
data/lib/mongo/util/version.rb
CHANGED