mongoid_auto_increment_id 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +26 -26
- metadata +20 -14
data/README.md
CHANGED
@@ -8,44 +8,44 @@ Idea from MongoDB document: [How to Make an Auto Incrementing Field](http://www.
|
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
# for Mongoid 2.4.x
|
16
|
-
gem 'mongoid_auto_increment_id', "0.4.0"
|
17
|
-
# for Mongoid 3.0.x
|
18
|
-
gem 'mongoid_auto_increment_id', "0.5.0"
|
11
|
+
```ruby
|
12
|
+
# Support Mongoid 3.0.0 - 4.0.0+
|
13
|
+
gem 'mongoid_auto_increment_id', "0.6.0"
|
14
|
+
```
|
19
15
|
|
20
16
|
## USAGE
|
21
17
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
18
|
+
```ruby
|
19
|
+
ruby > post = Post.new(:title => "Hello world")
|
20
|
+
=> #<Post _id: , _type: nil, title: "Hello world", body: nil>
|
21
|
+
ruby > post.save
|
22
|
+
=> true
|
23
|
+
ruby > post.inspect
|
24
|
+
=> "#<Post _id: 6, _type: nil, title: \"Hello world\", body: nil>"
|
25
|
+
ruby > Post.find("6")
|
26
|
+
=> "#<Post _id: 6, _type: nil, title: \"Hello world\", body: nil>"
|
27
|
+
ruby > Post.find(6)
|
28
|
+
=> "#<Post _id: 6, _type: nil, title: \"Hello world\", body: nil>"
|
29
|
+
ruby > Post.desc(:_id).all.to_a.collect { |row| row.id }
|
30
|
+
=> [20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1]
|
31
|
+
```
|
34
32
|
|
35
33
|
|
36
34
|
## Performance
|
37
35
|
|
36
|
+
This is a branchmark results run in MacBook Pro Retina.
|
37
|
+
|
38
38
|
with `mongoid_auto_increment_id`:
|
39
39
|
|
40
40
|
```
|
41
41
|
user system total real
|
42
|
-
Generate 1 0.
|
42
|
+
Generate 1 0.000000 0.000000 0.000000 ( 0.004301)
|
43
43
|
Post current: 1
|
44
44
|
|
45
|
-
Generate 100 0.
|
45
|
+
Generate 100 0.070000 0.000000 0.070000 ( 0.091638)
|
46
46
|
Post current: 101
|
47
47
|
|
48
|
-
Generate 10,000
|
48
|
+
Generate 10,000 7.300000 0.570000 7.870000 ( 9.962469)
|
49
49
|
Post current: 10101
|
50
50
|
```
|
51
51
|
|
@@ -53,12 +53,12 @@ without:
|
|
53
53
|
|
54
54
|
```
|
55
55
|
user system total real
|
56
|
-
Generate 1 0.000000 0.000000 0.000000 ( 0.
|
56
|
+
Generate 1 0.000000 0.000000 0.000000 ( 0.002569)
|
57
57
|
Post current: 1
|
58
58
|
|
59
|
-
Generate 100 0.
|
59
|
+
Generate 100 0.050000 0.000000 0.050000 ( 0.052045)
|
60
60
|
Post current: 101
|
61
61
|
|
62
|
-
Generate 10,000
|
62
|
+
Generate 10,000 5.220000 0.170000 5.390000 ( 5.389207)
|
63
63
|
Post current: 10101
|
64
64
|
```
|
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: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,24 +9,30 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mongoid
|
16
|
+
prerelease: false
|
16
17
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.0.0
|
22
|
+
- - <
|
20
23
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
24
|
+
version: 4.1.0
|
25
|
+
none: false
|
22
26
|
type: :runtime
|
23
|
-
prerelease: false
|
24
27
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
28
|
requirements:
|
27
|
-
- -
|
29
|
+
- - ! '>='
|
28
30
|
- !ruby/object:Gem::Version
|
29
|
-
version: 3.
|
31
|
+
version: 3.0.0
|
32
|
+
- - <
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 4.1.0
|
35
|
+
none: false
|
30
36
|
description: This gem for change Mongoid id field as Integer like MySQL.
|
31
37
|
email:
|
32
38
|
- huacnlee@gmail.com
|
@@ -43,20 +49,20 @@ rdoc_options: []
|
|
43
49
|
require_paths:
|
44
50
|
- lib
|
45
51
|
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
-
none: false
|
47
52
|
requirements:
|
48
|
-
- - '>='
|
53
|
+
- - ! '>='
|
49
54
|
- !ruby/object:Gem::Version
|
50
55
|
version: '0'
|
51
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
56
|
none: false
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
58
|
requirements:
|
54
|
-
- - '>='
|
59
|
+
- - ! '>='
|
55
60
|
- !ruby/object:Gem::Version
|
56
61
|
version: '0'
|
62
|
+
none: false
|
57
63
|
requirements: []
|
58
64
|
rubyforge_project:
|
59
|
-
rubygems_version: 1.8.
|
65
|
+
rubygems_version: 1.8.24
|
60
66
|
signing_key:
|
61
67
|
specification_version: 3
|
62
68
|
summary: Override id field with MySQL like auto increment for Mongoid
|