mongo_utils 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.travis.yml +1 -1
- data/README.md +13 -0
- data/lib/mongo_utils/aggregation.rb +15 -0
- data/lib/mongo_utils/version.rb +1 -1
- data/mongo_utils.gemspec +2 -3
- metadata +11 -22
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -4,3 +4,16 @@
|
|
4
4
|
|
5
5
|
This project is intended to be a collection of useful utilities for
|
6
6
|
working with MongoDB.
|
7
|
+
|
8
|
+
|
9
|
+
### Usage
|
10
|
+
|
11
|
+
The project is organized into modules which you can include into your
|
12
|
+
classes.
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
class Person
|
16
|
+
include MongoUtils::Aggregation
|
17
|
+
end
|
18
|
+
```
|
19
|
+
|
@@ -2,6 +2,21 @@ module MongoUtils
|
|
2
2
|
module Aggregation
|
3
3
|
extend ActiveSupport::Concern
|
4
4
|
|
5
|
+
# The only requirement of the Aggregation module is that you have a class
|
6
|
+
# method defined on the including class called `collection`. Many of the
|
7
|
+
# popular ORMs provide this for you. Otherwise, you could do something
|
8
|
+
# like the following:
|
9
|
+
#
|
10
|
+
# @example
|
11
|
+
# class Person
|
12
|
+
# include MongoUtils::Aggregation
|
13
|
+
#
|
14
|
+
# def self.collection
|
15
|
+
# @db ||= Mongo::Connection.new.db('my_db')
|
16
|
+
# @collection ||= @db.collection('people')
|
17
|
+
# end
|
18
|
+
# end
|
19
|
+
#
|
5
20
|
module ClassMethods
|
6
21
|
|
7
22
|
# Groups by the created_at date by the interval passed in
|
data/lib/mongo_utils/version.rb
CHANGED
data/mongo_utils.gemspec
CHANGED
@@ -20,8 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
21
|
s.require_paths = ["lib"]
|
22
22
|
|
23
|
-
s.add_dependency 'mongo', '~> 1.3.0'
|
24
|
-
s.add_dependency 'activesupport', '~> 3.0'
|
25
|
-
s.add_dependency 'mongoid', '~> 2.0'
|
26
23
|
s.add_dependency 'bson_ext'
|
24
|
+
s.add_dependency 'activesupport', '~> 3.0'
|
25
|
+
s.add_development_dependency 'mongoid', '~> 2.0'
|
27
26
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongo_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,19 +12,19 @@ cert_chain: []
|
|
12
12
|
date: 2011-11-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement: &
|
15
|
+
name: bson_ext
|
16
|
+
requirement: &70100497467140 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70100497467140
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: activesupport
|
27
|
-
requirement: &
|
27
|
+
requirement: &70100477348340 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,29 +32,18 @@ dependencies:
|
|
32
32
|
version: '3.0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70100477348340
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: mongoid
|
38
|
-
requirement: &
|
38
|
+
requirement: &70100477345360 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
version: '2.0'
|
44
|
-
type: :
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: *70282812065480
|
47
|
-
- !ruby/object:Gem::Dependency
|
48
|
-
name: bson_ext
|
49
|
-
requirement: &70282812062060 !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
|
-
requirements:
|
52
|
-
- - ! '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
type: :runtime
|
44
|
+
type: :development
|
56
45
|
prerelease: false
|
57
|
-
version_requirements: *
|
46
|
+
version_requirements: *70100477345360
|
58
47
|
description: A collection of utilities for working with MongoDB.
|
59
48
|
email:
|
60
49
|
- ajsharp@gmail.com
|