We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 94c44a7 commit 75faa71Copy full SHA for 75faa71
lib/mongo/operation/update/bulk_result.rb
@@ -92,7 +92,7 @@ def n_modified
92
if n && reply.documents.first[MODIFIED]
93
n += reply.documents.first[MODIFIED]
94
else
95
- nil
+ 0
96
end
97
98
@@ -106,7 +106,13 @@ def n_modified
106
#
107
# @since 2.1.0
108
def upserted
109
- reply.documents.first[UPSERTED] || []
+ return [] unless acknowledged?
110
+ @replies.reduce([]) do |ids, reply|
111
+ if upserted_ids = reply.documents.first[UPSERTED]
112
+ ids += upserted_ids
113
+ end
114
+ ids
115
116
117
118
private
0 commit comments