Skip to content

Commit 2d1298e

Browse files
committed
fixes #57
1 parent 6c29b04 commit 2d1298e

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

lib/mongo.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ defmodule Mongo do
11171117
upsert: Keyword.get(opts, :upsert),
11181118
multi: multi,
11191119
collation: Keyword.get(opts, :collation),
1120-
arrayFilters: Keyword.get(opts, :filters)
1120+
arrayFilters: Keyword.get(opts, :array_filters)
11211121
} |> filter_nils()
11221122

11231123
cmd = [

lib/mongo/bulk_write.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ defmodule Mongo.BulkWrite do
414414
upsert: Keyword.get(update_opts, :upsert),
415415
multi: Keyword.get(update_opts, :multi) || false,
416416
collation: Keyword.get(update_opts, :collation),
417-
arrayFilters: Keyword.get(update_opts, :filters)
417+
arrayFilters: Keyword.get(update_opts, :array_filters)
418418
] |> filter_nils()
419419

420420
end

lib/mongo/unordered_bulk.ex

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ defmodule Mongo.UnorderedBulk do
7777
%UnorderedBulk{coll: coll}
7878
end
7979

80+
@doc """
81+
Adds the two unordered bulks together.
82+
"""
83+
def add(%UnorderedBulk{coll: coll_a} = a, %UnorderedBulk{coll: coll_b} = b) when coll_a == coll_b do
84+
%UnorderedBulk{coll: coll_a,
85+
inserts: a.inserts ++ b.inserts,
86+
updates: a.updates ++ b.updates,
87+
deletes: a.deletes ++ b.deletes}
88+
end
89+
8090
@doc """
8191
Appends a bulk operation to the unordered bulk. One of the field (inserts, updates or deletes)
8292
will be updated.

0 commit comments

Comments
 (0)