mongoid-shell 0.5.1 → 0.5.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +39 -40
- data/lib/mongoid/shell/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: caa302a6929ce5b0953f7909336d13ced51e1149bcbf57564afa8fb39407cb54
|
|
4
|
+
data.tar.gz: 9476f5a48754a1d426006be1c366999e0ca1ff8cc961f6c1bb41e9a50cfae96d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f7b26e08e9b89e8f2a9e9d0f43c49b35d9701b379e81ac12cf8b2b8a992f356154915e59896ca88305c68eed3653446b9e510bbcfee05f9c3104014152e11f64
|
|
7
|
+
data.tar.gz: 151c8c5436158fdb0d9629dd797232eb6198aaa91e422ec7c64b5a12b1fb87b863e375bee396cdda5dff032897206e5e7118c22e34c978c39bef1c319139792a
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
### 0.5.2 (2026/11/24)
|
|
2
|
+
|
|
3
|
+
* [#27](https://github.com/mongoid/mongoid-shell/pull/27): Expand command rendering, error, and entrypoint tests and combine coverage across supported Mongoid versions - [@dblock](https://github.com/dblock).
|
|
4
|
+
* [#29](https://github.com/mongoid/mongoid-shell/pull/29): Lint Markdown, YAML, and spelling with rubocop-md, rubocop-prose, rubocop-spellcheck, and rubocop-yaml in a separate Lint workflow, and clean up documentation - [@dblock](https://github.com/dblock).
|
|
5
|
+
* [#30](https://github.com/mongoid/mongoid-shell/pull/30): Run tests only on default-branch pushes and pull requests, cancel superseded pull request runs, skip duplicate lint in the test matrix, and bound job times - [@dblock](https://github.com/dblock).
|
|
6
|
+
* [#31](https://github.com/mongoid/mongoid-shell/pull/31): Release with ruby-gem-release from a manually dispatched GitHub Actions workflow using RubyGems Trusted Publishing, with dry runs - [@dblock](https://github.com/dblock).
|
|
7
|
+
* [#33](https://github.com/mongoid/mongoid-shell/pull/33): Ignore `vendor/bundle` so the release workflow's clean-checkout check passes after `bundler-cache` installs gems - [@dblock](https://github.com/dblock).
|
|
8
|
+
* [#34](https://github.com/mongoid/mongoid-shell/pull/34): Upgrade danger-pr-comment to 0.3.0 from the `danger` organization, skip empty Danger report comments, and require current Danger gems - [@dblock](https://github.com/dblock).
|
|
9
|
+
|
|
1
10
|
### 0.5.1 (2026/10/15)
|
|
2
11
|
|
|
3
12
|
* [#17](https://github.com/mongoid/mongoid-shell/issues/17): Preserve Extended JSON queries through shell escaping and serialize Hash queries for `mongodump` and `mongoexport` - [@dblock](https://github.com/dblock).
|
data/README.md
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
|
-
Mongoid::Shell
|
|
2
|
-
==============
|
|
1
|
+
# Mongoid::Shell
|
|
3
2
|
|
|
4
|
-
[](https://badge.fury.io/rb/mongoid-shell)
|
|
5
|
-
[](https://github.com/mongoid/mongoid-shell/actions/workflows/test.yml)
|
|
6
|
-
[](https://github.com/mongoid/mongoid-shell/actions/workflows/rubocop.yml)
|
|
7
|
-
[](https://coveralls.io/github/mongoid/mongoid-shell?branch=master)
|
|
8
|
-
|
|
9
|
-
CI collects SimpleCov coverage on Ruby 3.4 with Mongoid 9 and MongoDB 8.0 and submits one report to Coveralls using GitHub's workflow token. To generate a local report, run `COVERAGE=true MONGOID_VERSION=9 bundle install` followed by `COVERAGE=true MONGOID_VERSION=9 bundle exec rake spec`. Reports are written to `coverage/`.
|
|
3
|
+
[](https://badge.fury.io/rb/mongoid-shell) [](https://github.com/mongoid/mongoid-shell/actions/workflows/test.yml) [](https://github.com/mongoid/mongoid-shell/actions/workflows/lint.yml) [](https://coveralls.io/github/mongoid/mongoid-shell?branch=master)
|
|
10
4
|
|
|
11
5
|
Create mongo command-lines from Mongoid configuration.
|
|
12
6
|
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add the gem to your Gemfile and run `bundle install`.
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem 'mongoid-shell'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
13
17
|
For example, connect to your production database without having to remember the entire command line using a `db:production:shell` Rake task.
|
|
14
18
|
|
|
15
|
-
```
|
|
16
|
-
namespace :db
|
|
17
|
-
namespace :production
|
|
18
|
-
task :shell
|
|
19
|
-
Mongoid.load! File.join(Rails.root,
|
|
19
|
+
```ruby
|
|
20
|
+
namespace :db do
|
|
21
|
+
namespace :production do
|
|
22
|
+
task :shell do
|
|
23
|
+
Mongoid.load! File.join(Rails.root, 'config/mongoid.yml'), :production
|
|
20
24
|
system Mongoid::Shell::Commands::Mongo.new.to_s
|
|
21
25
|
end
|
|
22
26
|
end
|
|
@@ -25,14 +29,14 @@ end
|
|
|
25
29
|
|
|
26
30
|
Commands can be created for the current default session or you can pass a session as an argument to a new command.
|
|
27
31
|
|
|
28
|
-
```
|
|
32
|
+
```ruby
|
|
29
33
|
Mongoid::Shell::Commands::Mongodump.new # will use Mongoid.default_session
|
|
30
|
-
Mongoid::Shell::Commands::Mongodump.new(session: Moped::Session.new([
|
|
34
|
+
Mongoid::Shell::Commands::Mongodump.new(session: Moped::Session.new(['127.0.0.1:27017']))
|
|
31
35
|
```
|
|
32
36
|
|
|
33
37
|
Commands accept parameters.
|
|
34
38
|
|
|
35
|
-
```
|
|
39
|
+
```ruby
|
|
36
40
|
out = File.join(Dir.tmpdir, 'db_backup')
|
|
37
41
|
mongodump = Mongoid::Shell::Commands::Mongodump.new(db: 'another_database', out: out)
|
|
38
42
|
system mongodump.to_s # mongodump --db another_database --out /tmp/db_backup
|
|
@@ -40,34 +44,32 @@ system mongodump.to_s # mongodump --db another_database --out /tmp/db_backup
|
|
|
40
44
|
|
|
41
45
|
To specify parameters multiple times, set them to arrays.
|
|
42
46
|
|
|
43
|
-
```
|
|
44
|
-
mongodump = Mongoid::Shell::Commands::Mongodump.new(excludeCollection: %w
|
|
47
|
+
```ruby
|
|
48
|
+
mongodump = Mongoid::Shell::Commands::Mongodump.new(excludeCollection: %w[users products])
|
|
45
49
|
system mongodump.to_s # mongodump --excludeCollection users --excludeCollection products
|
|
46
50
|
```
|
|
47
51
|
|
|
48
52
|
To use output in logs, pass the `mask_sensitive` option to `to_s`.
|
|
49
53
|
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
=> "mongo 59.1.22.1:27017/mongoid --username user --password ********"
|
|
54
|
+
```ruby
|
|
55
|
+
Mongoid::Shell::Commands::Mongo.new.to_s(mask_sensitive: true)
|
|
56
|
+
# => "mongo 59.1.22.1:27017/mongoid --username user --password ********"
|
|
53
57
|
|
|
54
|
-
|
|
55
|
-
=> "mongo 59.1.22.1:27017/mongoid --username user --password (masked)"
|
|
58
|
+
Mongoid::Shell::Commands::Mongo.new.to_s(mask_sensitive: '(masked)')
|
|
59
|
+
# => "mongo 59.1.22.1:27017/mongoid --username user --password (masked)"
|
|
56
60
|
```
|
|
57
61
|
|
|
58
|
-
Compatibility
|
|
59
|
-
-------------
|
|
62
|
+
## Compatibility
|
|
60
63
|
|
|
61
64
|
This gem supports Mongoid 3, 4, 5, 6, 7, 8 and 9.
|
|
62
65
|
|
|
63
|
-
Supported Commands
|
|
64
|
-
------------------
|
|
66
|
+
## Supported Commands
|
|
65
67
|
|
|
66
68
|
### Mongo
|
|
67
69
|
|
|
68
70
|
The mongo shell is an interactive JavaScript shell for MongoDB. The `Mongoid::Shell::Commands::Mongo` class generates a command line to connect to MongoDB. A particularly useful feature is that it will always yield the address of the master node of a MongoDB replica set.
|
|
69
71
|
|
|
70
|
-
```
|
|
72
|
+
```ruby
|
|
71
73
|
Mongoid::Shell::Commands::Mongo.new.to_s
|
|
72
74
|
```
|
|
73
75
|
|
|
@@ -77,7 +79,7 @@ Supports `--username`, `--password`, `--eval`, `--nodb`, `--norc`, `--quiet`, `-
|
|
|
77
79
|
|
|
78
80
|
Mongodump is a utility for creating a binary export of the contents of a database.
|
|
79
81
|
|
|
80
|
-
```
|
|
82
|
+
```ruby
|
|
81
83
|
mongodump = Mongoid::Shell::Commands::Mongodump.new(collection: 'test')
|
|
82
84
|
mongodump.to_s # mongodump --db test --collection test
|
|
83
85
|
```
|
|
@@ -98,7 +100,7 @@ system mongodump.to_s
|
|
|
98
100
|
|
|
99
101
|
The mongorestore tool imports content from binary database dump, created by mongodump into a specific database.
|
|
100
102
|
|
|
101
|
-
```
|
|
103
|
+
```ruby
|
|
102
104
|
mongorestore = Mongoid::Shell::Commands::Mongorestore.new(collection: 'test', restore: '/tmp/db_backup')
|
|
103
105
|
mongorestore.to_s # mongorestore --db test --collection test /tmp/db_backup
|
|
104
106
|
```
|
|
@@ -109,7 +111,7 @@ The `Mongoid::Shell::Commands::Mongorestore` class supports `--db`, `--host`, `-
|
|
|
109
111
|
|
|
110
112
|
The mongoexport tool produces a JSON or CSV export of data stored in a MongoDB instance.
|
|
111
113
|
|
|
112
|
-
```
|
|
114
|
+
```ruby
|
|
113
115
|
mongoexport = Mongoid::Shell::Commands::Mongoexport.new(collection: 'traffic', out: 'traffic.json')
|
|
114
116
|
mongoexport.to_s # mongoexport --db test --collection traffic --out traffic.json
|
|
115
117
|
```
|
|
@@ -120,8 +122,7 @@ The `Mongoid::Shell::Commands::Mongoexport` class supports `--verbose`, `--quiet
|
|
|
120
122
|
|
|
121
123
|
The mongoimport tool imports content from an Extended JSON, CSV, or TSV export created by mongoexport, or potentially, another third-party export tool.
|
|
122
124
|
|
|
123
|
-
|
|
124
|
-
``` ruby
|
|
125
|
+
```ruby
|
|
125
126
|
mongoimport = Mongoid::Shell::Commands::Mongoimport.new(collection: 'contacts', file: 'contacts.json')
|
|
126
127
|
mongoimport.to_s # mongoimport --db test --collection contacts --file contacts.json
|
|
127
128
|
```
|
|
@@ -134,14 +135,12 @@ The mongostat utility provides a quick overview of the status of a currently run
|
|
|
134
135
|
|
|
135
136
|
The `Mongoid::Shell::Commands::Mongostat` class supports `--host`, `--username`, `--password`, `--rowcount`, `--discover`, `--noheaders`, `--http`, `--all`, `--ssl` and `--authenticationDatabase`.
|
|
136
137
|
|
|
137
|
-
Contributing
|
|
138
|
-
------------
|
|
138
|
+
## Contributing
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md), [CHANGELOG.md](CHANGELOG.md), and [RELEASING.md](RELEASING.md).
|
|
141
141
|
|
|
142
|
-
|
|
143
|
-
---------------------
|
|
142
|
+
## License
|
|
144
143
|
|
|
145
|
-
MIT License, see [LICENSE](
|
|
144
|
+
MIT License, see [LICENSE.md](LICENSE.md) for details.
|
|
146
145
|
|
|
147
|
-
(c) 2013-2026 [Daniel Doubrovkine](
|
|
146
|
+
(c) 2013-2026 [Daniel Doubrovkine](https://github.com/dblock), [Artsy Inc.](https://www.artsy.net)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mongoid-shell
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Doubrovkine
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-11-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: i18n
|
|
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
106
106
|
- !ruby/object:Gem::Version
|
|
107
107
|
version: 1.3.6
|
|
108
108
|
requirements: []
|
|
109
|
-
rubygems_version: 3.5.
|
|
109
|
+
rubygems_version: 3.5.22
|
|
110
110
|
signing_key:
|
|
111
111
|
specification_version: 4
|
|
112
112
|
summary: Derive shell commands from Mongoid configuration options.
|