ruby_mongo_utils 0.0.1 → 0.0.2

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.
data/.gitignore CHANGED
@@ -11,6 +11,7 @@ spec/reports
11
11
  test/tmp
12
12
  test/version_tmp
13
13
  tmp
14
+ mongodumps
14
15
 
15
16
  # YARD artifacts
16
17
  .yardoc
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in mongo_utils.gemspec
3
+ # Specify your gem's dependencies in ruby_mongo_utils.gemspec
4
4
  gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mongo_utils (0.0.1)
4
+ ruby_mongo_utils (0.0.1)
5
5
  mongoid
6
6
 
7
7
  GEM
@@ -40,5 +40,5 @@ PLATFORMS
40
40
 
41
41
  DEPENDENCIES
42
42
  database_cleaner
43
- mongo_utils!
44
43
  rspec
44
+ ruby_mongo_utils!
data/README.md CHANGED
@@ -6,7 +6,7 @@ Ruby Mongo Utilities
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
- gem 'mongo_utils'
9
+ gem 'ruby_mongo_utils'
10
10
 
11
11
  And then execute:
12
12
 
@@ -14,11 +14,35 @@ And then execute:
14
14
 
15
15
  Or install it yourself as:
16
16
 
17
- $ gem install mongo_utils
17
+ $ gem install ruby_mongo_utils
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ ### Stripable
22
+
23
+ Include MongoUtils::Stripable in your classes in order to prevent stroring nil, [], {}, 0, false in the Mongo!
24
+
25
+ class Page
26
+ include MongoUtils::Stripable
27
+ end
28
+
29
+ ## MongoDump and MongoRestore
30
+
31
+ Provide MongoDump with collection name, query and a path in order to backup entries:
32
+
33
+ MongoUtils::MongoDump.call(
34
+ collection: Page.collection_name,
35
+ query: "{ 'page_type': { '\\$ne': 'Wordpress' } }",
36
+ path: "#{Rails.root}/mongodumps"
37
+ )
38
+
39
+ Provide MongoRestore with collection name, filter and a path in order to restore matching entries:
40
+
41
+ MongoUtils::MongoRestore.call(
42
+ collection: Page.collection_name,
43
+ filter: "{ 'page_type': 'Facebook' }",
44
+ path: "#{Rails.root}/mongodumps"
45
+ )
22
46
 
23
47
  ## Contributing
24
48
 
@@ -1,3 +1,3 @@
1
1
  module MongoUtils
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
File without changes
@@ -7,6 +7,4 @@ class Page
7
7
  field :likes, type: Hash, default: { lifetime: { total: 0 } }
8
8
 
9
9
  embeds_many :posts
10
-
11
-
12
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_mongo_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -77,9 +77,7 @@ files:
77
77
  - lib/mongo_utils/mongo_restore.rb
78
78
  - lib/mongo_utils/stripable.rb
79
79
  - lib/mongo_utils/version.rb
80
- - mongo_utils.gemspec
81
- - mongodumps/mongo_utils_tests/pages.bson
82
- - mongodumps/mongo_utils_tests/pages.metadata.json
80
+ - ruby_mongo_utils.gemspec
83
81
  - spec/fixtures/page.rb
84
82
  - spec/fixtures/post.rb
85
83
  - spec/mongo_utils/mongo_restore_spec.rb
@@ -1 +0,0 @@
1
- {indexes:[{ "v" : 1, "key" : { "_id" : 1 }, "ns" : "mongo_utils_tests.pages", "name" : "_id_" }]}