mongo_doc 0.6.27 → 0.6.28
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.textile +1 -1
- data/lib/mongo_doc/collection.rb +21 -7
- data/lib/mongo_doc/version.rb +1 -1
- metadata +3 -3
data/README.textile
CHANGED
@@ -3,7 +3,7 @@ h1. MongoDoc
|
|
3
3
|
Version: 0.6.27 2011/03/05
|
4
4
|
|
5
5
|
I use MongoDoc in production on my own apps, and have been using (lightly)
|
6
|
-
MongoMapper and (heavily) Mongoid since
|
6
|
+
MongoMapper and (heavily) Mongoid since 2009. By Summer 2010, I had come to the
|
7
7
|
conclusion that something more 'native' was the right way to go, and I began
|
8
8
|
to use more and more features of MongoDB directly in my code. After more than
|
9
9
|
six months, I am convinced that 'native' is the right approach.
|
data/lib/mongo_doc/collection.rb
CHANGED
@@ -34,12 +34,19 @@ module MongoDoc
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def find(query = {}, options = {})
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
37
|
+
retried = false
|
38
|
+
begin
|
39
|
+
cursor = wrapped_cursor(query, options)
|
40
|
+
if block_given?
|
41
|
+
yield cursor
|
42
|
+
cursor.close
|
43
|
+
else
|
44
|
+
cursor
|
45
|
+
end
|
46
|
+
rescue Mongo::ConnectionFailure
|
47
|
+
raise if retried
|
48
|
+
retried = true
|
49
|
+
retry
|
43
50
|
end
|
44
51
|
end
|
45
52
|
|
@@ -48,7 +55,14 @@ module MongoDoc
|
|
48
55
|
end
|
49
56
|
|
50
57
|
def find_one(spec_or_object_id = nil, options = {})
|
51
|
-
|
58
|
+
retried = false
|
59
|
+
begin
|
60
|
+
MongoDoc::BSON.decode(_collection.find_one(spec_or_object_id, options))
|
61
|
+
rescue Mongo::ConnectionFailure
|
62
|
+
raise if retried
|
63
|
+
retried = true
|
64
|
+
retry
|
65
|
+
end
|
52
66
|
end
|
53
67
|
|
54
68
|
def insert(doc_or_docs, options = {})
|
data/lib/mongo_doc/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: mongo_doc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.6.
|
5
|
+
version: 0.6.28
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Les Hill
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-05-09 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
208
|
requirements: []
|
209
209
|
|
210
210
|
rubyforge_project:
|
211
|
-
rubygems_version: 1.6.
|
211
|
+
rubygems_version: 1.6.2
|
212
212
|
signing_key:
|
213
213
|
specification_version: 3
|
214
214
|
summary: ODM for MongoDB
|