mongous 0.1.3 → 0.2.0

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.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.adoc +142 -27
  3. data/README.ja.adoc +140 -25
  4. data/lib/mongous/document.rb +50 -27
  5. data/lib/mongous/extention.rb +56 -45
  6. data/lib/mongous/filter.rb +76 -57
  7. data/lib/mongous/version.rb +1 -1
  8. data/mongous.gemspec +3 -2
  9. data/sample/connect_auto_2.rb +2 -1
  10. data/sample/connect_default_2.rb +2 -1
  11. data/sample/connect_environ_2.rb +2 -1
  12. data/sample/connect_loadfile_2.rb +2 -1
  13. data/sample/declare_compact_1.rb +1 -1
  14. data/sample/declare_label_1.rb +1 -1
  15. data/sample/declare_ndex_1.rb +1 -1
  16. data/sample/declare_ndex_2.rb +1 -1
  17. data/sample/declare_strict_1.rb +7 -5
  18. data/sample/declare_strict_2.rb +3 -2
  19. data/sample/{multi_docs_1.rb → multi_collection_1.rb} +0 -0
  20. data/sample/multi_collection_2.rb +61 -0
  21. data/sample/query_basic_1.rb +3 -1
  22. data/sample/query_basic_2.rb +5 -3
  23. data/sample/query_basic_3.rb +2 -3
  24. data/sample/query_basic_4.rb +3 -4
  25. data/sample/query_basic_5.rb +2 -3
  26. data/sample/query_detail_3.rb +3 -2
  27. data/sample/{query_basic_6.rb → query_filter_1.rb} +8 -5
  28. data/sample/query_filter_2.rb +50 -0
  29. data/sample/query_find_1.rb +31 -0
  30. data/sample/query_projection_1.rb +5 -8
  31. data/sample/query_skip_limit_1.rb +37 -0
  32. data/sample/query_skip_limit_2.rb +49 -0
  33. data/sample/query_sort_order_1.rb +46 -0
  34. data/sample/save_basic_1.rb +0 -1
  35. data/sample/save_basic_2.rb +0 -1
  36. data/sample/save_basic_3.rb +0 -1
  37. data/sample/save_detail_1.rb +4 -3
  38. data/sample/save_detail_2.rb +4 -3
  39. data/sample/save_detail_3.rb +6 -5
  40. data/sample/save_verify_1.rb +3 -2
  41. data/sample/save_verify_3.rb +1 -1
  42. data/sample/zap_basic_2.rb +1 -1
  43. data/sample/zap_basic_3.rb +1 -1
  44. metadata +15 -14
  45. data/sample/multi_docs_2.rb +0 -58
  46. data/sample/query_limit_1.rb +0 -44
  47. data/sample/query_order_1.rb +0 -49
  48. data/sample/query_raw_1.rb +0 -33
  49. data/sample/template_article.rb +0 -5
  50. data/sample/template_person.rb +0 -12
@@ -1,49 +0,0 @@
1
-
2
- require "mongous"
3
-
4
- Mongous.connect!
5
-
6
- class Item
7
- include Mongous::Document
8
- end
9
-
10
-
11
- (0...10).each do |n|
12
- if item = Item.filter( n: n ).first
13
- item
14
- else
15
- Item.create( n: n )
16
- end
17
- end
18
- puts
19
-
20
- Item.each do |item|
21
- p item
22
- end
23
- puts
24
-
25
- Item.filter.sort(n: 1).each do |item|
26
- p item
27
- end
28
- puts
29
-
30
- Item.filter.sort(n: -1).each do |item|
31
- p item
32
- end
33
- puts
34
-
35
- Item.filter.order(n: -1).each do |item|
36
- p item
37
- end
38
- puts
39
-
40
- Item.filter( n: (3...8) ).order(n: -1).each do |item|
41
- p item
42
- end
43
- puts
44
-
45
- Item.filter( n: [0,2,4,6,8] ).order(n: -1).each do |item|
46
- p item
47
- end
48
- puts
49
-
@@ -1,33 +0,0 @@
1
-
2
- require "mongous"
3
-
4
- Mongous.connect!
5
-
6
- class Book
7
- include Mongous::Document
8
- end
9
-
10
-
11
- book = Book.collection.find.first
12
- p book
13
- puts
14
-
15
- Book.collection.find.each do |book|
16
- p book
17
- end
18
- puts
19
-
20
- Book.collection.find( title: /title/ ).each do |book|
21
- p book
22
- end
23
- puts
24
-
25
- Book.collection.find( {}, { projection: {_id: 0, title: 1, author: 1} } ).each do |book|
26
- p book
27
- end
28
- puts
29
-
30
- Book.collection.find( {title: /title/}, { projection: {_id: 0, title: 1, author: 1} } ).each do |book|
31
- p book
32
- end
33
-
@@ -1,5 +0,0 @@
1
-
2
- class Article
3
- include Mongous::Document
4
- end
5
-
@@ -1,12 +0,0 @@
1
-
2
- class Person
3
- include Mongous::Document
4
-
5
- field :fullname
6
- field :username
7
- field :age, Integer
8
- field :created_at, Date, &proc{ Date.today }
9
-
10
- verify :strict
11
- end
12
-