Skip to content

Commit

Permalink
upsert and other options support for batch updates
Browse files Browse the repository at this point in the history
  • Loading branch information
dj-nitehawk committed Apr 9, 2021
1 parent 662d353 commit af12c6f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion MongoDB.Entities/Commands/Update.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,13 @@ public Update<T> AddToQueue()
if (filter == null) throw new ArgumentException("Please use Match() method first!");
if (defs.Count == 0) throw new ArgumentException("Please use Modify() method first!");
if (Cache<T>.HasModifiedOn) Modify(b => b.CurrentDate(Cache<T>.ModifiedOnPropName));
models.Add(new UpdateManyModel<T>(filter, Builders<T>.Update.Combine(defs)) { ArrayFilters = options.ArrayFilters });
models.Add(new UpdateManyModel<T>(filter, Builders<T>.Update.Combine(defs))
{
ArrayFilters = options.ArrayFilters,
Collation = options.Collation,
Hint = options.Hint,
IsUpsert = options.IsUpsert
});
filter = Builders<T>.Filter.Empty;
defs.Clear();
options = new UpdateOptions();
Expand Down
6 changes: 3 additions & 3 deletions MongoDB.Entities/MongoDB.Entities.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<Description>A data access library for MongoDB with an elegant api, LINQ support and built-in entity relationship management.</Description>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageProjectUrl>https://mongodb-entities.com</PackageProjectUrl>
<Version>20.9.2</Version>
<Version>20.9.3</Version>
<Copyright>Đĵ ΝιΓΞΗΛψΚ</Copyright>
<PackageReleaseNotes>- hotfix for watcher method ambiguity
<PackageReleaseNotes>- upsert and other options support for batch updates
- upgraded official driver to latest</PackageReleaseNotes>
<PackageId>MongoDB.Entities</PackageId>
<Product>MongoDB.Entities</Product>
Expand All @@ -28,7 +28,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="MongoDB.Driver" Version="2.12.1" />
<PackageReference Include="MongoDB.Driver" Version="2.12.2" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit af12c6f

Please sign in to comment.