mongoid_auto_increment_id 0.2 → 0.2.1
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/README.md +49 -21
- metadata +6 -9
- data/.gitignore +0 -1
- data/mongoid_auto_increment_id.gemspec +0 -21
data/README.md
CHANGED
@@ -2,29 +2,57 @@ This gem for change Mongoid id field as Integer like MySQL.
|
|
2
2
|
|
3
3
|
Idea from MongoDB document: [How to Make an Auto Incrementing Field](http://www.mongodb.org/display/DOCS/How+to+Make+an+Auto+Incrementing+Field)
|
4
4
|
|
5
|
-
|
5
|
+
## Status
|
6
6
|
|
7
|
-
|
8
|
-
gem 'mongoid_auto_increment_id'
|
9
|
-
```
|
7
|
+
[](http://travis-ci.org/huacnlee/mongoid_auto_increment_id)
|
10
8
|
|
11
|
-
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
gem 'mongoid_auto_increment_id'
|
12
|
+
|
13
|
+
|
14
|
+
## REQUIREMENTS
|
12
15
|
|
13
16
|
* Mongoid 2.2.0+
|
14
17
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
18
|
+
## USAGE
|
19
|
+
|
20
|
+
ruby > post = Post.new(:title => "Hello world")
|
21
|
+
=> #<Post _id: , _type: nil, title: "Hello world", body: nil>
|
22
|
+
ruby > post.save
|
23
|
+
=> true
|
24
|
+
ruby > post.inspect
|
25
|
+
=> "#<Post _id: 6, _type: nil, title: \"Hello world\", body: nil>"
|
26
|
+
ruby > Post.find("6")
|
27
|
+
=> "#<Post _id: 6, _type: nil, title: \"Hello world\", body: nil>"
|
28
|
+
ruby > Post.find(6)
|
29
|
+
=> "#<Post _id: 6, _type: nil, title: \"Hello world\", body: nil>"
|
30
|
+
ruby > Post.desc(:_id).all.to_a.collect { |row| row.id }
|
31
|
+
=> [20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1]
|
32
|
+
|
33
|
+
|
34
|
+
## Performance
|
35
|
+
|
36
|
+
with `mongoid_auto_increment_id`:
|
37
|
+
|
38
|
+
user system total real
|
39
|
+
Generate 1 0.010000 0.000000 0.010000 ( 0.006182)
|
40
|
+
Post current: 1
|
41
|
+
|
42
|
+
Generate 100 0.130000 0.010000 0.140000 ( 0.406619)
|
43
|
+
Post current: 101
|
44
|
+
|
45
|
+
Generate 10,000 10.160000 0.560000 10.720000 ( 12.518690)
|
46
|
+
Post current: 10101
|
47
|
+
|
48
|
+
without:
|
49
|
+
|
50
|
+
user system total real
|
51
|
+
Generate 1 0.000000 0.000000 0.000000 ( 0.171523)
|
52
|
+
Post current: 1
|
53
|
+
|
54
|
+
Generate 100 0.110000 0.000000 0.110000 ( 0.129670)
|
55
|
+
Post current: 101
|
56
|
+
|
57
|
+
Generate 10,000 9.340000 0.470000 9.810000 ( 11.233426)
|
58
|
+
Post current: 10101
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_auto_increment_id
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-10-18 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mongoid
|
16
|
-
requirement: &
|
16
|
+
requirement: &2156434260 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,19 +21,16 @@ dependencies:
|
|
21
21
|
version: 2.2.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
25
|
-
description:
|
26
|
-
from MongoDB document: [How to Make an Auto Incrementing Field](http://www.mongodb.org/display/DOCS/How+to+Make+an+Auto+Incrementing+Field)"
|
24
|
+
version_requirements: *2156434260
|
25
|
+
description: This gem for change Mongoid id field as Integer like MySQL.
|
27
26
|
email:
|
28
27
|
- huacnlee@gmail.com
|
29
28
|
executables: []
|
30
29
|
extensions: []
|
31
30
|
extra_rdoc_files: []
|
32
31
|
files:
|
33
|
-
- .gitignore
|
34
|
-
- README.md
|
35
32
|
- lib/mongoid_auto_increment_id.rb
|
36
|
-
-
|
33
|
+
- README.md
|
37
34
|
homepage: https://github.com/huacnlee/mongoid_auto_increment_id
|
38
35
|
licenses: []
|
39
36
|
post_install_message:
|
data/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
*.gem
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
|
4
|
-
Gem::Specification.new do |s|
|
5
|
-
s.name = "mongoid_auto_increment_id"
|
6
|
-
s.version = "0.2"
|
7
|
-
s.platform = Gem::Platform::RUBY
|
8
|
-
s.authors = ["Jason Lee"]
|
9
|
-
s.email = ["huacnlee@gmail.com"]
|
10
|
-
s.homepage = "https://github.com/huacnlee/mongoid_auto_increment_id"
|
11
|
-
s.summary = %q{Override id field with MySQL like auto increment for Mongoid}
|
12
|
-
s.description = %q{This gem for change Mongoid id field as Integer like MySQL.
|
13
|
-
|
14
|
-
Idea from MongoDB document: [How to Make an Auto Incrementing Field](http://www.mongodb.org/display/DOCS/How+to+Make+an+Auto+Incrementing+Field)}
|
15
|
-
s.files = `git ls-files`.split("\n")
|
16
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
|
-
s.require_paths = ["lib"]
|
19
|
-
|
20
|
-
s.add_dependency "mongoid", ["~> 2.2.0"]
|
21
|
-
end
|