Compare commits

...

6 Commits

Author SHA1 Message Date
alexandre-spieser 0cf24b1dcf integration tested index management functionality 2018-10-07 19:05:59 +01:00
alexandre-spieser fd8f98e375 adding more tests 2018-10-01 22:31:08 +01:00
alexandre-spieser fa6687c084 fixed test by adding semaphores. Also reduced collections name to avoid hitting the 127 byte limit regarding index names. 2018-09-30 19:26:25 +01:00
alexandre-spieser 0b939592ba Implementation of index management.CreateTextIndexWithOptionAsync is failing. 2018-09-30 19:07:38 +01:00
alexandre-spieser ad18170804 work on indexes continued 2018-09-17 22:39:14 +01:00
alexandre-spieser 099e16a88c prep work on indexes methods 2018-09-17 08:41:36 +01:00
21 changed files with 1619 additions and 52 deletions
@@ -5,7 +5,7 @@ using System;
namespace CoreIntegrationTests namespace CoreIntegrationTests
{ {
[CollectionName("CoreTestingCollectionNameAttributePartitionedTKey")] [CollectionName("CoreTestingCNameAttrPart")]
public class CorePartitionedCollectionNameDoc : TestDoc, IPartitionedDocument public class CorePartitionedCollectionNameDoc : TestDoc, IPartitionedDocument
{ {
public CorePartitionedCollectionNameDoc() public CorePartitionedCollectionNameDoc()
@@ -5,7 +5,7 @@ using System;
namespace CoreIntegrationTests namespace CoreIntegrationTests
{ {
[CollectionName("TestingCollectionNameAttributePartitionedTKey")] [CollectionName("TestingCNameAttrPartTKey")]
public class CoreTKeyPartitionedCollectionNameDoc : TestDoc<Guid>, IPartitionedDocument public class CoreTKeyPartitionedCollectionNameDoc : TestDoc<Guid>, IPartitionedDocument
{ {
public CoreTKeyPartitionedCollectionNameDoc() public CoreTKeyPartitionedCollectionNameDoc()
@@ -9,7 +9,7 @@
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="2.1.2" /> <PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="2.1.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="MongoDB.Driver" Version="2.7.0" /> <PackageReference Include="MongoDB.Driver" Version="2.7.0" />
<PackageReference Include="MongoDbGenericRepository" Version="1.3.7" /> <PackageReference Include="MongoDbGenericRepository" Version="1.3.8" />
<PackageReference Include="xunit" Version="2.4.0" /> <PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.console" Version="2.4.0" /> <PackageReference Include="xunit.runner.console" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
@@ -3,7 +3,9 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Linq.Expressions;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xunit; using Xunit;
@@ -11,7 +13,7 @@ namespace CoreIntegrationTests.Infrastructure
{ {
public abstract class MongoDbDocumentTestBase<T> : public abstract class MongoDbDocumentTestBase<T> :
IClassFixture<MongoDbTestFixture<T, Guid>> IClassFixture<MongoDbTestFixture<T, Guid>>
where T: TestDoc, new() where T : TestDoc, new()
{ {
private readonly MongoDbTestFixture<T, Guid> _fixture; private readonly MongoDbTestFixture<T, Guid> _fixture;
@@ -73,7 +75,7 @@ namespace CoreIntegrationTests.Infrastructure
// Act // Act
SUT.AddOne<T>(document); SUT.AddOne<T>(document);
// Assert // Assert
long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T>(e => e.Id.Equals(document.Id)) long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T>(e => e.Id.Equals(document.Id))
: SUT.Count<T>(e => e.Id.Equals(document.Id), PartitionKey); : SUT.Count<T>(e => e.Id.Equals(document.Id), PartitionKey);
Assert.True(1 == count, GetTestName()); Assert.True(1 == count, GetTestName());
} }
@@ -88,7 +90,7 @@ namespace CoreIntegrationTests.Infrastructure
// Assert // Assert
long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T>(e => e.Id.Equals(document.Id)) long count = string.IsNullOrEmpty(PartitionKey) ? SUT.Count<T>(e => e.Id.Equals(document.Id))
: SUT.Count<T>(e => e.Id.Equals(document.Id), PartitionKey); : SUT.Count<T>(e => e.Id.Equals(document.Id), PartitionKey);
Assert.True (1 == count, GetTestName()); Assert.True(1 == count, GetTestName());
} }
[Fact] [Fact]
@@ -103,7 +105,7 @@ namespace CoreIntegrationTests.Infrastructure
|| e.Id.Equals(documents[1].Id)) || e.Id.Equals(documents[1].Id))
: SUT.Count<T>(e => e.Id.Equals(documents[0].Id) : SUT.Count<T>(e => e.Id.Equals(documents[0].Id)
|| e.Id.Equals(documents[1].Id), PartitionKey); || e.Id.Equals(documents[1].Id), PartitionKey);
Assert.True (2 == count, GetTestName()); Assert.True(2 == count, GetTestName());
} }
[Fact] [Fact]
@@ -114,7 +116,7 @@ namespace CoreIntegrationTests.Infrastructure
{ {
// Arrange // Arrange
var documents = new List<T> { new T(), new T(), new T(), new T() }; var documents = new List<T> { new T(), new T(), new T(), new T() };
if(documents.Any(e => e is IPartitionedDocument)) if (documents.Any(e => e is IPartitionedDocument))
{ {
var secondPartitionKey = $"{PartitionKey}-2"; var secondPartitionKey = $"{PartitionKey}-2";
((IPartitionedDocument)documents[2]).PartitionKey = secondPartitionKey; ((IPartitionedDocument)documents[2]).PartitionKey = secondPartitionKey;
@@ -144,7 +146,7 @@ namespace CoreIntegrationTests.Infrastructure
|| e.Id.Equals(documents[1].Id)) || e.Id.Equals(documents[1].Id))
: SUT.Count<T>(e => e.Id.Equals(documents[0].Id) : SUT.Count<T>(e => e.Id.Equals(documents[0].Id)
|| e.Id.Equals(documents[1].Id), PartitionKey); || e.Id.Equals(documents[1].Id), PartitionKey);
Assert.True (2 == count, GetTestName()); Assert.True(2 == count, GetTestName());
} }
[Fact] [Fact]
@@ -235,7 +237,7 @@ namespace CoreIntegrationTests.Infrastructure
var cursor = SUT.GetCursor<T>(x => x.Id.Equals(document.Id), PartitionKey); var cursor = SUT.GetCursor<T>(x => x.Id.Equals(document.Id), PartitionKey);
var count = cursor.Count(); var count = cursor.Count();
// Assert // Assert
Assert.True (1 == count, GetTestName()); Assert.True(1 == count, GetTestName());
} }
[Fact] [Fact]
@@ -490,10 +492,10 @@ namespace CoreIntegrationTests.Infrastructure
Assert.True(result); Assert.True(result);
var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey); var updatedDocument = SUT.GetById<T>(document.Id, PartitionKey);
Assert.True(null != updatedDocument); Assert.True(null != updatedDocument);
Assert.True(childrenToAdd[0].Type== updatedDocument.Children[0].Type, GetTestName()); Assert.True(childrenToAdd[0].Type == updatedDocument.Children[0].Type, GetTestName());
Assert.True(childrenToAdd[0].Value== updatedDocument.Children[0].Value, GetTestName()); Assert.True(childrenToAdd[0].Value == updatedDocument.Children[0].Value, GetTestName());
Assert.True(childrenToAdd[1].Type== updatedDocument.Children[1].Type, GetTestName()); Assert.True(childrenToAdd[1].Type == updatedDocument.Children[1].Type, GetTestName());
Assert.True(childrenToAdd[1].Value== updatedDocument.Children[1].Value, GetTestName()); Assert.True(childrenToAdd[1].Value == updatedDocument.Children[1].Value, GetTestName());
} }
#endregion Update #endregion Update
@@ -509,7 +511,7 @@ namespace CoreIntegrationTests.Infrastructure
// Act // Act
var result = SUT.DeleteOne<T>(document); var result = SUT.DeleteOne<T>(document);
// Assert // Assert
Assert.True (1 == result); Assert.True(1 == result);
Assert.False(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName()); Assert.False(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
} }
@@ -522,7 +524,7 @@ namespace CoreIntegrationTests.Infrastructure
// Act // Act
var result = SUT.DeleteOne<T>(e => e.Id.Equals(document.Id), PartitionKey); var result = SUT.DeleteOne<T>(e => e.Id.Equals(document.Id), PartitionKey);
// Assert // Assert
Assert.True (1 == result); Assert.True(1 == result);
Assert.False(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName()); Assert.False(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
} }
@@ -535,7 +537,7 @@ namespace CoreIntegrationTests.Infrastructure
// Act // Act
var result = await SUT.DeleteOneAsync<T>(document); var result = await SUT.DeleteOneAsync<T>(document);
// Assert // Assert
Assert.True (1 == result); Assert.True(1 == result);
Assert.False(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName()); Assert.False(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
} }
@@ -548,7 +550,7 @@ namespace CoreIntegrationTests.Infrastructure
// Act // Act
var result = await SUT.DeleteOneAsync<T>(e => e.Id.Equals(document.Id), PartitionKey); var result = await SUT.DeleteOneAsync<T>(e => e.Id.Equals(document.Id), PartitionKey);
// Assert // Assert
Assert.True (1 == result); Assert.True(1 == result);
Assert.False(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName()); Assert.False(SUT.Any<T>(e => e.Id.Equals(document.Id), PartitionKey), GetTestName());
} }
@@ -765,7 +767,8 @@ namespace CoreIntegrationTests.Infrastructure
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}"; var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5); var documents = CreateTestDocuments(5);
var i = 1; var i = 1;
documents.ForEach(e => { documents.ForEach(e =>
{
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++); e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria; e.SomeContent = criteria;
}); });
@@ -787,7 +790,8 @@ namespace CoreIntegrationTests.Infrastructure
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}"; var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5); var documents = CreateTestDocuments(5);
var i = 1; var i = 1;
documents.ForEach(e => { documents.ForEach(e =>
{
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++); e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria; e.SomeContent = criteria;
}); });
@@ -809,7 +813,8 @@ namespace CoreIntegrationTests.Infrastructure
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}"; var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5); var documents = CreateTestDocuments(5);
var i = 1; var i = 1;
documents.ForEach(e => { documents.ForEach(e =>
{
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++); e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria; e.SomeContent = criteria;
}); });
@@ -831,7 +836,8 @@ namespace CoreIntegrationTests.Infrastructure
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}"; var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5); var documents = CreateTestDocuments(5);
var i = 1; var i = 1;
documents.ForEach(e => { documents.ForEach(e =>
{
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++); e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria; e.SomeContent = criteria;
}); });
@@ -853,7 +859,8 @@ namespace CoreIntegrationTests.Infrastructure
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}"; var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5); var documents = CreateTestDocuments(5);
var i = 1; var i = 1;
documents.ForEach(e => { documents.ForEach(e =>
{
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++); e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria; e.SomeContent = criteria;
}); });
@@ -875,7 +882,8 @@ namespace CoreIntegrationTests.Infrastructure
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}"; var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5); var documents = CreateTestDocuments(5);
var i = 1; var i = 1;
documents.ForEach(e => { documents.ForEach(e =>
{
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++); e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria; e.SomeContent = criteria;
}); });
@@ -897,7 +905,8 @@ namespace CoreIntegrationTests.Infrastructure
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}"; var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5); var documents = CreateTestDocuments(5);
var i = 1; var i = 1;
documents.ForEach(e => { documents.ForEach(e =>
{
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++); e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria; e.SomeContent = criteria;
}); });
@@ -919,7 +928,8 @@ namespace CoreIntegrationTests.Infrastructure
var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}"; var criteria = $"{GetTestName()}.{DocumentTypeName}.{Guid.NewGuid()}";
var documents = CreateTestDocuments(5); var documents = CreateTestDocuments(5);
var i = 1; var i = 1;
documents.ForEach(e => { documents.ForEach(e =>
{
e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++); e.Nested.SomeDate = e.Nested.SomeDate.AddDays(i++);
e.SomeContent = criteria; e.SomeContent = criteria;
}); });
@@ -936,6 +946,135 @@ namespace CoreIntegrationTests.Infrastructure
#endregion Max / Min Queries #endregion Max / Min Queries
#region Index Management
static SemaphoreSlim textIndexSemaphore = new SemaphoreSlim(1, 1);
[Fact]
public async Task CreateTextIndexNoOptionAsync()
{
// Arrange
const string expectedIndexName = "SomeContent_text";
// Act
await textIndexSemaphore.WaitAsync();
try
{
var result = await SUT.CreateTextIndexAsync<T>(x => x.SomeContent, null, PartitionKey);
// Assert
var listOfIndexNames = await SUT.GetIndexesNamesAsync<T>(PartitionKey);
Assert.Contains(expectedIndexName, listOfIndexNames);
// Cleanup
await SUT.DropIndexAsync<T>(expectedIndexName, PartitionKey);
}
finally
{
textIndexSemaphore.Release();
}
}
[Fact]
public async Task CreateTextIndexWithOptionAsync()
{
// Arrange
string expectedIndexName = $"{Guid.NewGuid()}";
var option = new IndexCreationOptions
{
Name = expectedIndexName
};
await textIndexSemaphore.WaitAsync();
try
{
// Act
var result = await SUT.CreateTextIndexAsync<T>(x => x.AddedAtUtc, option, PartitionKey);
// Assert
var listOfIndexNames = await SUT.GetIndexesNamesAsync<T>(PartitionKey);
Assert.Contains(expectedIndexName, listOfIndexNames);
// Cleanup
await SUT.DropIndexAsync<T>(expectedIndexName, PartitionKey);
}
finally
{
textIndexSemaphore.Release();
}
}
[Fact]
public async Task CreateAscendingIndexAsync()
{
// Arrange
const string expectedIndexName = "SomeContent_1";
// Act
var result = await SUT.CreateAscendingIndexAsync<T>(x => x.SomeContent, null, PartitionKey);
// Assert
var listOfIndexNames = await SUT.GetIndexesNamesAsync<T>(PartitionKey);
Assert.Contains(expectedIndexName, listOfIndexNames);
// Cleanup
await SUT.DropIndexAsync<T>(expectedIndexName, PartitionKey);
}
[Fact]
public async Task CreateDescendingIndexAsync()
{
// Arrange
const string expectedIndexName = "SomeContent_-1";
// Act
var result = await SUT.CreateDescendingIndexAsync<T>(x => x.SomeContent, null, PartitionKey);
// Assert
var listOfIndexNames = await SUT.GetIndexesNamesAsync<T>(PartitionKey);
Assert.Contains(expectedIndexName, listOfIndexNames);
// Cleanup
await SUT.DropIndexAsync<T>(expectedIndexName, PartitionKey);
}
[Fact]
public async Task CreateHashedIndexAsync()
{
// Arrange
const string expectedIndexName = "SomeContent_hashed";
// Act
var result = await SUT.CreateHashedIndexAsync<T>(x => x.SomeContent, null, PartitionKey);
// Assert
var listOfIndexNames = await SUT.GetIndexesNamesAsync<T>(PartitionKey);
Assert.Contains(expectedIndexName, listOfIndexNames);
// Cleanup
await SUT.DropIndexAsync<T>(expectedIndexName, PartitionKey);
}
[Fact]
public async Task CreateCombinedTextIndexAsync()
{
// Arrange
const string expectedIndexName = "SomeContent2_text_SomeContent3_text";
// Act
Expression <Func<T, object>> ex = x => x.SomeContent2;
Expression <Func<T, object>> ex2 = x => x.SomeContent3;
var result = await SUT.CreateCombinedTextIndexAsync<T>(new[] { ex, ex2 }, null, PartitionKey);
// Assert
var listOfIndexNames = await SUT.GetIndexesNamesAsync<T>(PartitionKey);
Assert.Contains(expectedIndexName, listOfIndexNames);
// Cleanup
await SUT.DropIndexAsync<T>(expectedIndexName, PartitionKey);
}
#endregion Index Management
#region Test Utils #region Test Utils
[MethodImpl(MethodImplOptions.NoInlining)] [MethodImpl(MethodImplOptions.NoInlining)]
@@ -3,7 +3,9 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Linq.Expressions;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xunit; using Xunit;
@@ -937,6 +939,135 @@ namespace CoreIntegrationTests.Infrastructure
#endregion Max / Min Queries #endregion Max / Min Queries
#region Index Management
static SemaphoreSlim textIndexSemaphore = new SemaphoreSlim(1, 1);
[Fact]
public async Task CreateTextIndexNoOptionAsync()
{
// Arrange
const string expectedIndexName = "SomeContent_text";
// Act
await textIndexSemaphore.WaitAsync();
try
{
var result = await SUT.CreateTextIndexAsync<T, TKey>(x => x.SomeContent, null, PartitionKey);
// Assert
var listOfIndexNames = await SUT.GetIndexesNamesAsync<T, TKey>(PartitionKey);
Assert.Contains(expectedIndexName, listOfIndexNames);
// Cleanup
await SUT.DropIndexAsync<T, TKey>(expectedIndexName, PartitionKey);
}
finally
{
textIndexSemaphore.Release();
}
}
[Fact]
public async Task CreateTextIndexWithOptionAsync()
{
// Arrange
string expectedIndexName = $"{Guid.NewGuid()}";
var option = new IndexCreationOptions
{
Name = expectedIndexName
};
await textIndexSemaphore.WaitAsync();
try
{
// Act
var result = await SUT.CreateTextIndexAsync<T, TKey>(x => x.Version, option, PartitionKey);
// Assert
var listOfIndexNames = await SUT.GetIndexesNamesAsync<T, TKey>(PartitionKey);
Assert.Contains(expectedIndexName, listOfIndexNames);
// Cleanup
await SUT.DropIndexAsync<T, TKey>(expectedIndexName, PartitionKey);
}
finally
{
textIndexSemaphore.Release();
}
}
[Fact]
public async Task CreateAscendingIndexAsync()
{
// Arrange
const string expectedIndexName = "SomeContent_1";
// Act
var result = await SUT.CreateAscendingIndexAsync<T, TKey>(x => x.SomeContent, null, PartitionKey);
// Assert
var listOfIndexNames = await SUT.GetIndexesNamesAsync<T, TKey>(PartitionKey);
Assert.Contains(expectedIndexName, listOfIndexNames);
// Cleanup
await SUT.DropIndexAsync<T, TKey>(expectedIndexName, PartitionKey);
}
[Fact]
public async Task CreateDescendingIndexAsync()
{
// Arrange
const string expectedIndexName = "SomeContent_-1";
// Act
var result = await SUT.CreateDescendingIndexAsync<T, TKey>(x => x.SomeContent, null, PartitionKey);
// Assert
var listOfIndexNames = await SUT.GetIndexesNamesAsync<T, TKey>(PartitionKey);
Assert.Contains(expectedIndexName, listOfIndexNames);
// Cleanup
await SUT.DropIndexAsync<T, TKey>(expectedIndexName, PartitionKey);
}
[Fact]
public async Task CreateHashedIndexAsync()
{
// Arrange
const string expectedIndexName = "SomeContent_hashed";
// Act
var result = await SUT.CreateHashedIndexAsync<T, TKey>(x => x.SomeContent, null, PartitionKey);
// Assert
var listOfIndexNames = await SUT.GetIndexesNamesAsync<T, TKey>(PartitionKey);
Assert.Contains(expectedIndexName, listOfIndexNames);
// Cleanup
await SUT.DropIndexAsync<T, TKey>(expectedIndexName, PartitionKey);
}
[Fact]
public async Task CreateCombinedTextIndexAsync()
{
// Arrange
const string expectedIndexName = "SomeContent4_text_SomeContent5_text";
// Act
Expression<Func<T, object>> ex = x => x.SomeContent4;
Expression<Func<T, object>> ex2 = x => x.SomeContent5;
var result = await SUT.CreateCombinedTextIndexAsync<T, TKey>(new[] { ex, ex2 }, null, PartitionKey);
// Assert
var listOfIndexNames = await SUT.GetIndexesNamesAsync<T, TKey>(PartitionKey);
Assert.Contains(expectedIndexName, listOfIndexNames);
// Cleanup
await SUT.DropIndexAsync<T, TKey>(expectedIndexName, PartitionKey);
}
#endregion Index Management
#region Test Utils #region Test Utils
[MethodImpl(MethodImplOptions.NoInlining)] [MethodImpl(MethodImplOptions.NoInlining)]
private string GetCurrentMethod() private string GetCurrentMethod()
@@ -50,6 +50,8 @@ namespace CoreIntegrationTests.Infrastructure
public int SomeValue { get; set; } public int SomeValue { get; set; }
public string SomeContent { get; set; } public string SomeContent { get; set; }
public string SomeContent2 { get; set; }
public string SomeContent3 { get; set; }
public int GroupingKey { get; set; } public int GroupingKey { get; set; }
@@ -78,6 +80,8 @@ namespace CoreIntegrationTests.Infrastructure
} }
public string SomeContent { get; set; } public string SomeContent { get; set; }
public string SomeContent4 { get; set; }
public string SomeContent5 { get; set; }
public Nested Nested { get; set; } public Nested Nested { get; set; }
+7 -7
View File
@@ -31,32 +31,32 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="DnsClient, Version=1.0.7.0, Culture=neutral, PublicKeyToken=4574bb5573c51424, processorArchitecture=MSIL"> <Reference Include="DnsClient, Version=1.0.7.0, Culture=neutral, PublicKeyToken=4574bb5573c51424, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDbGenericRepository.1.3.7\lib\net45\DnsClient.dll</HintPath> <HintPath>..\packages\MongoDbGenericRepository.1.3.8\lib\net45\DnsClient.dll</HintPath>
</Reference> </Reference>
<Reference Include="MongoDB.Bson, Version=2.7.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="MongoDB.Bson, Version=2.7.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDbGenericRepository.1.3.7\lib\net45\MongoDB.Bson.dll</HintPath> <HintPath>..\packages\MongoDbGenericRepository.1.3.8\lib\net45\MongoDB.Bson.dll</HintPath>
</Reference> </Reference>
<Reference Include="MongoDB.Driver, Version=2.7.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="MongoDB.Driver, Version=2.7.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDbGenericRepository.1.3.7\lib\net45\MongoDB.Driver.dll</HintPath> <HintPath>..\packages\MongoDbGenericRepository.1.3.8\lib\net45\MongoDB.Driver.dll</HintPath>
</Reference> </Reference>
<Reference Include="MongoDB.Driver.Core, Version=2.7.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="MongoDB.Driver.Core, Version=2.7.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDbGenericRepository.1.3.7\lib\net45\MongoDB.Driver.Core.dll</HintPath> <HintPath>..\packages\MongoDbGenericRepository.1.3.8\lib\net45\MongoDB.Driver.Core.dll</HintPath>
</Reference> </Reference>
<Reference Include="MongoDbGenericRepository, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="MongoDbGenericRepository, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDbGenericRepository.1.3.7\lib\net45\MongoDbGenericRepository.dll</HintPath> <HintPath>..\packages\MongoDbGenericRepository.1.3.8\lib\net45\MongoDbGenericRepository.dll</HintPath>
</Reference> </Reference>
<Reference Include="nunit.framework, Version=3.9.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL"> <Reference Include="nunit.framework, Version=3.9.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.3.9.0\lib\net45\nunit.framework.dll</HintPath> <HintPath>..\packages\NUnit.3.9.0\lib\net45\nunit.framework.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL"> <Reference Include="System.Buffers, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDbGenericRepository.1.3.7\lib\net45\System.Buffers.dll</HintPath> <HintPath>..\packages\MongoDbGenericRepository.1.3.8\lib\net45\System.Buffers.dll</HintPath>
</Reference> </Reference>
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> <Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\MongoDbGenericRepository.1.3.7\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath> <HintPath>..\packages\MongoDbGenericRepository.1.3.8\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
+1 -1
View File
@@ -4,7 +4,7 @@
<package id="MongoDB.Bson" version="2.7.0" targetFramework="net461" /> <package id="MongoDB.Bson" version="2.7.0" targetFramework="net461" />
<package id="MongoDB.Driver" version="2.7.0" targetFramework="net461" /> <package id="MongoDB.Driver" version="2.7.0" targetFramework="net461" />
<package id="MongoDB.Driver.Core" version="2.7.0" targetFramework="net461" /> <package id="MongoDB.Driver.Core" version="2.7.0" targetFramework="net461" />
<package id="MongoDbGenericRepository" version="1.3.7" targetFramework="net461" /> <package id="MongoDbGenericRepository" version="1.3.8" targetFramework="net461" />
<package id="NUnit" version="3.9.0" targetFramework="net461" /> <package id="NUnit" version="3.9.0" targetFramework="net461" />
<package id="NUnit.ConsoleRunner" version="3.7.0" targetFramework="net461" /> <package id="NUnit.ConsoleRunner" version="3.7.0" targetFramework="net461" />
<package id="System.Buffers" version="4.3.0" targetFramework="net461" /> <package id="System.Buffers" version="4.3.0" targetFramework="net461" />
@@ -12,7 +12,7 @@ namespace MongoDbGenericRepository
/// <summary> /// <summary>
/// The IBaseMongoRepository exposes the CRUD functionality of the BaseMongoRepository. /// The IBaseMongoRepository exposes the CRUD functionality of the BaseMongoRepository.
/// </summary> /// </summary>
public interface IBaseMongoRepository : IReadOnlyMongoRepository public interface IBaseMongoRepository : IReadOnlyMongoRepository, IMongoDbCollectionIndexRepository
{ {
#region Create #region Create
@@ -0,0 +1,193 @@
using MongoDbGenericRepository.Models;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Threading.Tasks;
namespace MongoDbGenericRepository
{
/// <summary>
/// The repository interface for managing indexes
/// </summary>
public interface IMongoDbCollectionIndexRepository
{
/// <summary>
/// Create a text index on the given field.
/// IndexCreationOptions can be supplied to further specify
/// how the creation should be done.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
where TDocument : IDocument;
/// <summary>
/// Create a text index on the given field.
/// IndexCreationOptions can be supplied to further specify
/// how the creation should be done.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="field">The field we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Creates an index on the given field in ascending order.
/// IndexCreationOptions can be supplied to further specify
/// how the creation should be done.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null) where TDocument : IDocument;
/// <summary>
/// Creates an index on the given field in ascending order.
/// IndexCreationOptions can be supplied to further specify
/// how the creation should be done.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="field">The field we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Creates an index on the given field in descending order.
/// IndexCreationOptions can be supplied to further specify
/// how the creation should be done.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>A string containing the result of the operation.</returns>
Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
where TDocument : IDocument;
/// <summary>
/// Creates an index on the given field in descending order.
/// IndexCreationOptions can be supplied to further specify
/// how the creation should be done.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="field">The field we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Creates a hashed index on the given field.
/// IndexCreationOptions can be supplied to further specify
/// how the creation should be done.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="field">The field we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>A string containing the result of the operation.</returns>
Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
where TDocument : IDocument;
/// <summary>
/// Creates a hashed index on the given field.
/// IndexCreationOptions can be supplied to further specify
/// how the creation should be done.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="field">The field we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Creates a combined text index.
/// IndexCreationOptions can be supplied to further specify
/// how the creation should be done.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="fields">The fields we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
where TDocument : IDocument;
/// <summary>
/// Creates a combined text index.
/// IndexCreationOptions can be supplied to further specify
/// how the creation should be done.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="fields">The fields we want to index.</param>
/// <param name="indexCreationOptions">Options for creating an index.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>The result of the create index operation.</returns>
Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Drops the index given a field name
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="indexName">The name of the index</param>
/// <param name="partitionKey">An optional partition key</param>
Task DropIndexAsync<TDocument>(string indexName, string partitionKey = null)
where TDocument : IDocument;
/// <summary>
/// Drops the index given a field name
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="indexName">The name of the index</param>
/// <param name="partitionKey">An optional partition key</param>
Task DropIndexAsync<TDocument, TKey>(string indexName, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
/// <summary>
/// Returns the names of the indexes present on a collection.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="partitionKey">An optional partition key</param>
/// <returns>A list containing the names of the indexes on on the concerned collection.</returns>
Task<List<string>> GetIndexesNamesAsync<TDocument>(string partitionKey = null)
where TDocument : IDocument;
/// <summary>
/// Returns the names of the indexes present on a collection.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="partitionKey">An optional partition key</param>
/// <returns>A list containing the names of the indexes on on the concerned collection.</returns>
Task<List<string>> GetIndexesNamesAsync<TDocument, TKey>(string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>;
}
}
@@ -0,0 +1,176 @@
using MongoDB.Driver;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Linq.Expressions;
using MongoDbGenericRepository.Models;
using System.Linq;
namespace MongoDbGenericRepository
{
/// <summary>
/// The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.
/// Its constructor must be given a connection string and a database name.
/// </summary>
public abstract partial class BaseMongoRepository : ReadOnlyMongoRepository, IBaseMongoRepository
{
#region Index Management
/// <inheritdoc />
public async Task<string> CreateTextIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
where TDocument : IDocument
{
return await CreateTextIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey);
}
/// <inheritdoc />
public async Task<string> CreateTextIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return await HandlePartitioned<TDocument, TKey>(partitionKey).Indexes
.CreateOneAsync(
new CreateIndexModel<TDocument>(
Builders<TDocument>.IndexKeys.Text(field),
indexCreationOptions == null ? null : MapIndexOptions(indexCreationOptions)
));
}
/// <inheritdoc />
public async Task<string> CreateAscendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null) where TDocument : IDocument
{
return await CreateAscendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey);
}
/// <inheritdoc />
public async Task<string> CreateAscendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
var collection = HandlePartitioned<TDocument, TKey>(partitionKey);
var createOptions = indexCreationOptions == null ? null : MapIndexOptions(indexCreationOptions);
var indexKey = Builders<TDocument>.IndexKeys;
return await collection.Indexes
.CreateOneAsync(
new CreateIndexModel<TDocument>(indexKey.Ascending(field), createOptions));
}
/// <inheritdoc />
public async Task<string> CreateDescendingIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
where TDocument : IDocument
{
return await CreateDescendingIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey);
}
/// <inheritdoc />
public async Task<string> CreateDescendingIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
var collection = HandlePartitioned<TDocument, TKey>(partitionKey);
var createOptions = indexCreationOptions == null ? null : MapIndexOptions(indexCreationOptions);
var indexKey = Builders<TDocument>.IndexKeys;
return await collection.Indexes
.CreateOneAsync(
new CreateIndexModel<TDocument>(indexKey.Descending(field), createOptions));
}
/// <inheritdoc />
public async Task<string> CreateHashedIndexAsync<TDocument>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
where TDocument : IDocument
{
return await CreateHashedIndexAsync<TDocument, Guid>(field, indexCreationOptions, partitionKey);
}
/// <inheritdoc />
public async Task<string> CreateHashedIndexAsync<TDocument, TKey>(Expression<Func<TDocument, object>> field, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
var collection = HandlePartitioned<TDocument, TKey>(partitionKey);
var createOptions = indexCreationOptions == null ? null : MapIndexOptions(indexCreationOptions);
var indexKey = Builders<TDocument>.IndexKeys;
return await collection.Indexes
.CreateOneAsync(
new CreateIndexModel<TDocument>(indexKey.Hashed(field), createOptions));
}
/// <inheritdoc />
public async Task<string> CreateCombinedTextIndexAsync<TDocument>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions = null, string partitionKey = null) where TDocument : IDocument
{
return await CreateCombinedTextIndexAsync<TDocument, Guid>(fields, indexCreationOptions, partitionKey);
}
/// <inheritdoc />
public async Task<string> CreateCombinedTextIndexAsync<TDocument, TKey>(IEnumerable<Expression<Func<TDocument, object>>> fields, IndexCreationOptions indexCreationOptions = null, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
var collection = HandlePartitioned<TDocument, TKey>(partitionKey);
var createOptions = indexCreationOptions == null ? null : MapIndexOptions(indexCreationOptions);
var listOfDefs = new List<IndexKeysDefinition<TDocument>>();
foreach (var field in fields)
{
listOfDefs.Add(Builders<TDocument>.IndexKeys.Text(field));
}
return await collection.Indexes
.CreateOneAsync(new CreateIndexModel<TDocument>(Builders<TDocument>.IndexKeys.Combine(listOfDefs), createOptions));
}
/// <inheritdoc />
public async Task DropIndexAsync<TDocument>(string indexName, string partitionKey = null)
where TDocument : IDocument
{
await DropIndexAsync<TDocument, Guid>(indexName, partitionKey);
}
/// <inheritdoc />
public async Task DropIndexAsync<TDocument, TKey>(string indexName, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
await HandlePartitioned<TDocument, TKey>(partitionKey).Indexes.DropOneAsync(indexName);
}
/// <inheritdoc />
public async Task<List<string>> GetIndexesNamesAsync<TDocument>(string partitionKey = null)
where TDocument : IDocument
{
return await GetIndexesNamesAsync<TDocument, Guid>(partitionKey);
}
/// <inheritdoc />
public async Task<List<string>> GetIndexesNamesAsync<TDocument, TKey>(string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
var indexCursor = await HandlePartitioned<TDocument, TKey>(partitionKey).Indexes.ListAsync();
var indexes = await indexCursor.ToListAsync();
return indexes.Select(e => e["name"].ToString()).ToList();
}
#endregion Index Management
private CreateIndexOptions MapIndexOptions(IndexCreationOptions indexCreationOptions)
{
return new CreateIndexOptions
{
Unique = indexCreationOptions.Unique,
TextIndexVersion = indexCreationOptions.TextIndexVersion,
SphereIndexVersion = indexCreationOptions.SphereIndexVersion,
Sparse = indexCreationOptions.Sparse,
Name = indexCreationOptions.Name,
Min = indexCreationOptions.Min,
Max = indexCreationOptions.Max,
LanguageOverride = indexCreationOptions.LanguageOverride,
ExpireAfter = indexCreationOptions.ExpireAfter,
DefaultLanguage = indexCreationOptions.DefaultLanguage,
BucketSize = indexCreationOptions.BucketSize,
Bits = indexCreationOptions.Bits,
Background = indexCreationOptions.Background,
Version = indexCreationOptions.Version
};
}
}
}
@@ -13,9 +13,8 @@ namespace MongoDbGenericRepository
/// The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation. /// The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.
/// Its constructor must be given a connection string and a database name. /// Its constructor must be given a connection string and a database name.
/// </summary> /// </summary>
public abstract class BaseMongoRepository : ReadOnlyMongoRepository, IBaseMongoRepository public abstract partial class BaseMongoRepository : ReadOnlyMongoRepository, IBaseMongoRepository
{ {
/// <summary> /// <summary>
/// The constructor taking a connection string and a database name. /// The constructor taking a connection string and a database name.
/// </summary> /// </summary>
@@ -230,7 +229,6 @@ namespace MongoDbGenericRepository
} }
} }
#endregion #endregion
#region Update #region Update
@@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MongoDbGenericRepository.Models
{
/// <summary>
/// Options for creating an index.
/// </summary>
public class IndexCreationOptions
{
/// <summary>
/// Gets or sets a value indicating whether the index is a unique index.
/// </summary>
public bool? Unique { get; set; }
/// <summary>
/// Gets or sets the index version for text indexes.
/// </summary>
public int? TextIndexVersion { get; set; }
/// <summary>
/// Gets or sets the index version for 2dsphere indexes.
/// </summary>
public int? SphereIndexVersion { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the index is a sparse index.
/// </summary>
public bool? Sparse { get; set; }
/// <summary>
/// Gets or sets the index name.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Gets or sets the min value for 2d indexes.
/// </summary>
public double? Min { get; set; }
/// <summary>
/// Gets or sets the max value for 2d indexes.
/// </summary>
public double? Max { get; set; }
/// <summary>
/// Gets or sets the language override.
/// </summary>
public string LanguageOverride { get; set; }
/// <summary>
/// Gets or sets when documents expire (used with TTL indexes).
/// </summary>
public TimeSpan? ExpireAfter { get; set; }
/// <summary>
/// Gets or sets the default language.
/// </summary>
public string DefaultLanguage { get; set; }
/// <summary>
/// Gets or sets the size of a geohash bucket.
/// </summary>
public double? BucketSize { get; set; }
/// <summary>
/// Gets or sets the precision, in bits, used with geohash indexes.
/// </summary>
public int? Bits { get; set; }
/// <summary>
/// Gets or sets a value indicating whether to create the index in the background.
/// </summary>
public bool? Background { get; set; }
/// <summary>
/// Gets or sets the version of the index.
/// </summary>
public int? Version { get; set; }
}
}
+12 -12
View File
@@ -76,23 +76,23 @@ namespace MongoDbGenericRepository
.FirstOrDefault() as CollectionNameAttribute)?.Name; .FirstOrDefault() as CollectionNameAttribute)?.Name;
} }
/// <summary> /// <summary>
/// Returns a collection for a document type. Also handles document types with a partition key. /// Returns a collection for a document type. Also handles document types with a partition key.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <param name="partitionKey">The optional value of the partition key.</param> /// <param name="partitionKey">The optional value of the partition key.</param>
public IMongoCollection<TDocument> GetCollection<TDocument>(string partitionKey = null) public IMongoCollection<TDocument> GetCollection<TDocument>(string partitionKey = null)
{ {
return Database.GetCollection<TDocument>(GetCollectionName<TDocument>(partitionKey)); return Database.GetCollection<TDocument>(GetCollectionName<TDocument>(partitionKey));
} }
/// <summary> /// <summary>
/// Drops a collection, use very carefully. /// Drops a collection, use very carefully.
/// </summary> /// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam> /// <typeparam name="TDocument">The type representing a Document.</typeparam>
public void DropCollection<TDocument>(string partitionKey = null) public void DropCollection<TDocument>(string partitionKey = null)
{ {
Database.DropCollection(GetCollectionName<TDocument>(partitionKey)); Database.DropCollection(GetCollectionName<TDocument>(partitionKey));
} }
/// <summary> /// <summary>
@@ -2,7 +2,7 @@
<package > <package >
<metadata> <metadata>
<id>MongoDbGenericRepository</id> <id>MongoDbGenericRepository</id>
<version>1.3.7</version> <version>1.3.8</version>
<title>MongoDb Generic Repository</title> <title>MongoDb Generic Repository</title>
<authors>Alexandre Spieser</authors> <authors>Alexandre Spieser</authors>
<owners>Alexandre Spieser</owners> <owners>Alexandre Spieser</owners>
@@ -10,7 +10,7 @@
<projectUrl>https://github.com/alexandre-spieser/mongodb-generic-repository</projectUrl> <projectUrl>https://github.com/alexandre-spieser/mongodb-generic-repository</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance> <requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>A generic repository implementation using the MongoDB C# Sharp 2.0 driver.</description> <description>A generic repository implementation using the MongoDB C# Sharp 2.0 driver.</description>
<releaseNotes>Upgraded dependencies. Full support for bulk insertion and deletion of documents of the same type but with different partitionkey values. Added methods for Min and Max queries.</releaseNotes> <releaseNotes>Release notes are at https://github.com/alexandre-spieser/mongodb-generic-repository/releases</releaseNotes>
<copyright>Copyright 2018 (c) Alexandre Spieser. All rights reserved.</copyright> <copyright>Copyright 2018 (c) Alexandre Spieser. All rights reserved.</copyright>
<tags>MongoDb Repository Generic NoSql</tags> <tags>MongoDb Repository Generic NoSql</tags>
<dependencies> <dependencies>
@@ -569,6 +569,170 @@
<param name="projection">The projected group result.</param> <param name="projection">The projected group result.</param>
<param name="partitionKey">The partition key of your document, if any.</param> <param name="partitionKey">The partition key of your document, if any.</param>
</member> </member>
<member name="T:MongoDbGenericRepository.IMongoDbCollectionIndexRepository">
<summary>
The repository interface for managing indexes
</summary>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateTextIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Create a text index on the given field.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateTextIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Create a text index on the given field.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateAscendingIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates an index on the given field in ascending order.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateAscendingIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates an index on the given field in ascending order.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateDescendingIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates an index on the given field in descending order.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>A string containing the result of the operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateDescendingIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates an index on the given field in descending order.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateHashedIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates a hashed index on the given field.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>A string containing the result of the operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateHashedIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates a hashed index on the given field.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateCombinedTextIndexAsync``1(System.Collections.Generic.IEnumerable{System.Linq.Expressions.Expression{System.Func{``0,System.Object}}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates a combined text index.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="fields">The fields we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateCombinedTextIndexAsync``2(System.Collections.Generic.IEnumerable{System.Linq.Expressions.Expression{System.Func{``0,System.Object}}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates a combined text index.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="fields">The fields we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.DropIndexAsync``1(System.String,System.String)">
<summary>
Drops the index given a field name
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="indexName">The name of the index</param>
<param name="partitionKey">An optional partition key</param>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.DropIndexAsync``2(System.String,System.String)">
<summary>
Drops the index given a field name
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="indexName">The name of the index</param>
<param name="partitionKey">An optional partition key</param>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.GetIndexesNamesAsync``1(System.String)">
<summary>
Returns the names of the indexes present on a collection.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="partitionKey">An optional partition key</param>
<returns>A list containing the names of the indexes on on the concerned collection.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.GetIndexesNamesAsync``2(System.String)">
<summary>
Returns the names of the indexes present on a collection.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="partitionKey">An optional partition key</param>
<returns>A list containing the names of the indexes on on the concerned collection.</returns>
</member>
<member name="T:MongoDbGenericRepository.IMongoDbContext"> <member name="T:MongoDbGenericRepository.IMongoDbContext">
<summary> <summary>
This is the interface of the IMongoDbContext which is managed by the <see cref="T:MongoDbGenericRepository.BaseMongoRepository"/>. This is the interface of the IMongoDbContext which is managed by the <see cref="T:MongoDbGenericRepository.BaseMongoRepository"/>.
@@ -989,6 +1153,10 @@
The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation. The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.
Its constructor must be given a connection string and a database name. Its constructor must be given a connection string and a database name.
</summary> </summary>
<summary>
The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.
Its constructor must be given a connection string and a database name.
</summary>
</member> </member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.#ctor(System.String,System.String)"> <member name="M:MongoDbGenericRepository.BaseMongoRepository.#ctor(System.String,System.String)">
<summary> <summary>
@@ -1585,6 +1753,48 @@
<typeparam name="TDocument">The document type.</typeparam> <typeparam name="TDocument">The document type.</typeparam>
<param name="document">The document.</param> <param name="document">The document.</param>
</member> </member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateTextIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateTextIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateAscendingIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateAscendingIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateDescendingIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateDescendingIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateHashedIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateHashedIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateCombinedTextIndexAsync``1(System.Collections.Generic.IEnumerable{System.Linq.Expressions.Expression{System.Func{``0,System.Object}}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateCombinedTextIndexAsync``2(System.Collections.Generic.IEnumerable{System.Linq.Expressions.Expression{System.Func{``0,System.Object}}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.DropIndexAsync``1(System.String,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.DropIndexAsync``2(System.String,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.GetIndexesNamesAsync``1(System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.GetIndexesNamesAsync``2(System.String)">
<inheritdoc />
</member>
<member name="T:MongoDbGenericRepository.Models.Document"> <member name="T:MongoDbGenericRepository.Models.Document">
<summary> <summary>
This class represents a basic document that can be stored in MongoDb. This class represents a basic document that can be stored in MongoDb.
@@ -1634,6 +1844,81 @@
Your document must implement this class in order for the MongoDbRepository to handle them. Your document must implement this class in order for the MongoDbRepository to handle them.
</summary> </summary>
</member> </member>
<member name="T:MongoDbGenericRepository.Models.IndexCreationOptions">
<summary>
Options for creating an index.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Unique">
<summary>
Gets or sets a value indicating whether the index is a unique index.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.TextIndexVersion">
<summary>
Gets or sets the index version for text indexes.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.SphereIndexVersion">
<summary>
Gets or sets the index version for 2dsphere indexes.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Sparse">
<summary>
Gets or sets a value indicating whether the index is a sparse index.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Name">
<summary>
Gets or sets the index name.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Min">
<summary>
Gets or sets the min value for 2d indexes.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Max">
<summary>
Gets or sets the max value for 2d indexes.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.LanguageOverride">
<summary>
Gets or sets the language override.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.ExpireAfter">
<summary>
Gets or sets when documents expire (used with TTL indexes).
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.DefaultLanguage">
<summary>
Gets or sets the default language.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.BucketSize">
<summary>
Gets or sets the size of a geohash bucket.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Bits">
<summary>
Gets or sets the precision, in bits, used with geohash indexes.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Background">
<summary>
Gets or sets a value indicating whether to create the index in the background.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Version">
<summary>
Gets or sets the version of the index.
</summary>
</member>
<member name="T:MongoDbGenericRepository.Models.IPartitionedDocument"> <member name="T:MongoDbGenericRepository.Models.IPartitionedDocument">
<summary> <summary>
This class represents a document that can be inserted in a collection that can be partitioned. This class represents a document that can be inserted in a collection that can be partitioned.
@@ -569,6 +569,170 @@
<param name="projection">The projected group result.</param> <param name="projection">The projected group result.</param>
<param name="partitionKey">The partition key of your document, if any.</param> <param name="partitionKey">The partition key of your document, if any.</param>
</member> </member>
<member name="T:MongoDbGenericRepository.IMongoDbCollectionIndexRepository">
<summary>
The repository interface for managing indexes
</summary>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateTextIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Create a text index on the given field.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateTextIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Create a text index on the given field.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateAscendingIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates an index on the given field in ascending order.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateAscendingIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates an index on the given field in ascending order.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateDescendingIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates an index on the given field in descending order.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>A string containing the result of the operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateDescendingIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates an index on the given field in descending order.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateHashedIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates a hashed index on the given field.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>A string containing the result of the operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateHashedIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates a hashed index on the given field.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateCombinedTextIndexAsync``1(System.Collections.Generic.IEnumerable{System.Linq.Expressions.Expression{System.Func{``0,System.Object}}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates a combined text index.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="fields">The fields we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateCombinedTextIndexAsync``2(System.Collections.Generic.IEnumerable{System.Linq.Expressions.Expression{System.Func{``0,System.Object}}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates a combined text index.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="fields">The fields we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.DropIndexAsync``1(System.String,System.String)">
<summary>
Drops the index given a field name
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="indexName">The name of the index</param>
<param name="partitionKey">An optional partition key</param>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.DropIndexAsync``2(System.String,System.String)">
<summary>
Drops the index given a field name
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="indexName">The name of the index</param>
<param name="partitionKey">An optional partition key</param>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.GetIndexesNamesAsync``1(System.String)">
<summary>
Returns the names of the indexes present on a collection.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="partitionKey">An optional partition key</param>
<returns>A list containing the names of the indexes on on the concerned collection.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.GetIndexesNamesAsync``2(System.String)">
<summary>
Returns the names of the indexes present on a collection.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="partitionKey">An optional partition key</param>
<returns>A list containing the names of the indexes on on the concerned collection.</returns>
</member>
<member name="T:MongoDbGenericRepository.IMongoDbContext"> <member name="T:MongoDbGenericRepository.IMongoDbContext">
<summary> <summary>
This is the interface of the IMongoDbContext which is managed by the <see cref="T:MongoDbGenericRepository.BaseMongoRepository"/>. This is the interface of the IMongoDbContext which is managed by the <see cref="T:MongoDbGenericRepository.BaseMongoRepository"/>.
@@ -989,6 +1153,10 @@
The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation. The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.
Its constructor must be given a connection string and a database name. Its constructor must be given a connection string and a database name.
</summary> </summary>
<summary>
The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.
Its constructor must be given a connection string and a database name.
</summary>
</member> </member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.#ctor(System.String,System.String)"> <member name="M:MongoDbGenericRepository.BaseMongoRepository.#ctor(System.String,System.String)">
<summary> <summary>
@@ -1585,6 +1753,48 @@
<typeparam name="TDocument">The document type.</typeparam> <typeparam name="TDocument">The document type.</typeparam>
<param name="document">The document.</param> <param name="document">The document.</param>
</member> </member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateTextIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateTextIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateAscendingIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateAscendingIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateDescendingIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateDescendingIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateHashedIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateHashedIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateCombinedTextIndexAsync``1(System.Collections.Generic.IEnumerable{System.Linq.Expressions.Expression{System.Func{``0,System.Object}}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateCombinedTextIndexAsync``2(System.Collections.Generic.IEnumerable{System.Linq.Expressions.Expression{System.Func{``0,System.Object}}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.DropIndexAsync``1(System.String,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.DropIndexAsync``2(System.String,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.GetIndexesNamesAsync``1(System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.GetIndexesNamesAsync``2(System.String)">
<inheritdoc />
</member>
<member name="T:MongoDbGenericRepository.Models.Document"> <member name="T:MongoDbGenericRepository.Models.Document">
<summary> <summary>
This class represents a basic document that can be stored in MongoDb. This class represents a basic document that can be stored in MongoDb.
@@ -1634,6 +1844,81 @@
Your document must implement this class in order for the MongoDbRepository to handle them. Your document must implement this class in order for the MongoDbRepository to handle them.
</summary> </summary>
</member> </member>
<member name="T:MongoDbGenericRepository.Models.IndexCreationOptions">
<summary>
Options for creating an index.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Unique">
<summary>
Gets or sets a value indicating whether the index is a unique index.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.TextIndexVersion">
<summary>
Gets or sets the index version for text indexes.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.SphereIndexVersion">
<summary>
Gets or sets the index version for 2dsphere indexes.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Sparse">
<summary>
Gets or sets a value indicating whether the index is a sparse index.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Name">
<summary>
Gets or sets the index name.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Min">
<summary>
Gets or sets the min value for 2d indexes.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Max">
<summary>
Gets or sets the max value for 2d indexes.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.LanguageOverride">
<summary>
Gets or sets the language override.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.ExpireAfter">
<summary>
Gets or sets when documents expire (used with TTL indexes).
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.DefaultLanguage">
<summary>
Gets or sets the default language.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.BucketSize">
<summary>
Gets or sets the size of a geohash bucket.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Bits">
<summary>
Gets or sets the precision, in bits, used with geohash indexes.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Background">
<summary>
Gets or sets a value indicating whether to create the index in the background.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Version">
<summary>
Gets or sets the version of the index.
</summary>
</member>
<member name="T:MongoDbGenericRepository.Models.IPartitionedDocument"> <member name="T:MongoDbGenericRepository.Models.IPartitionedDocument">
<summary> <summary>
This class represents a document that can be inserted in a collection that can be partitioned. This class represents a document that can be inserted in a collection that can be partitioned.
@@ -569,6 +569,170 @@
<param name="projection">The projected group result.</param> <param name="projection">The projected group result.</param>
<param name="partitionKey">The partition key of your document, if any.</param> <param name="partitionKey">The partition key of your document, if any.</param>
</member> </member>
<member name="T:MongoDbGenericRepository.IMongoDbCollectionIndexRepository">
<summary>
The repository interface for managing indexes
</summary>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateTextIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Create a text index on the given field.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateTextIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Create a text index on the given field.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateAscendingIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates an index on the given field in ascending order.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateAscendingIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates an index on the given field in ascending order.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateDescendingIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates an index on the given field in descending order.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>A string containing the result of the operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateDescendingIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates an index on the given field in descending order.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateHashedIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates a hashed index on the given field.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>A string containing the result of the operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateHashedIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates a hashed index on the given field.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="field">The field we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateCombinedTextIndexAsync``1(System.Collections.Generic.IEnumerable{System.Linq.Expressions.Expression{System.Func{``0,System.Object}}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates a combined text index.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="fields">The fields we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.CreateCombinedTextIndexAsync``2(System.Collections.Generic.IEnumerable{System.Linq.Expressions.Expression{System.Func{``0,System.Object}}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<summary>
Creates a combined text index.
IndexCreationOptions can be supplied to further specify
how the creation should be done.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="fields">The fields we want to index.</param>
<param name="indexCreationOptions">Options for creating an index.</param>
<param name="partitionKey">An optional partition key.</param>
<returns>The result of the create index operation.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.DropIndexAsync``1(System.String,System.String)">
<summary>
Drops the index given a field name
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="indexName">The name of the index</param>
<param name="partitionKey">An optional partition key</param>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.DropIndexAsync``2(System.String,System.String)">
<summary>
Drops the index given a field name
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="indexName">The name of the index</param>
<param name="partitionKey">An optional partition key</param>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.GetIndexesNamesAsync``1(System.String)">
<summary>
Returns the names of the indexes present on a collection.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<param name="partitionKey">An optional partition key</param>
<returns>A list containing the names of the indexes on on the concerned collection.</returns>
</member>
<member name="M:MongoDbGenericRepository.IMongoDbCollectionIndexRepository.GetIndexesNamesAsync``2(System.String)">
<summary>
Returns the names of the indexes present on a collection.
</summary>
<typeparam name="TDocument">The type representing a Document.</typeparam>
<typeparam name="TKey">The type of the primary key for a Document.</typeparam>
<param name="partitionKey">An optional partition key</param>
<returns>A list containing the names of the indexes on on the concerned collection.</returns>
</member>
<member name="T:MongoDbGenericRepository.IMongoDbContext"> <member name="T:MongoDbGenericRepository.IMongoDbContext">
<summary> <summary>
This is the interface of the IMongoDbContext which is managed by the <see cref="T:MongoDbGenericRepository.BaseMongoRepository"/>. This is the interface of the IMongoDbContext which is managed by the <see cref="T:MongoDbGenericRepository.BaseMongoRepository"/>.
@@ -989,6 +1153,10 @@
The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation. The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.
Its constructor must be given a connection string and a database name. Its constructor must be given a connection string and a database name.
</summary> </summary>
<summary>
The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation.
Its constructor must be given a connection string and a database name.
</summary>
</member> </member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.#ctor(System.String,System.String)"> <member name="M:MongoDbGenericRepository.BaseMongoRepository.#ctor(System.String,System.String)">
<summary> <summary>
@@ -1585,6 +1753,48 @@
<typeparam name="TDocument">The document type.</typeparam> <typeparam name="TDocument">The document type.</typeparam>
<param name="document">The document.</param> <param name="document">The document.</param>
</member> </member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateTextIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateTextIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateAscendingIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateAscendingIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateDescendingIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateDescendingIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateHashedIndexAsync``1(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateHashedIndexAsync``2(System.Linq.Expressions.Expression{System.Func{``0,System.Object}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateCombinedTextIndexAsync``1(System.Collections.Generic.IEnumerable{System.Linq.Expressions.Expression{System.Func{``0,System.Object}}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.CreateCombinedTextIndexAsync``2(System.Collections.Generic.IEnumerable{System.Linq.Expressions.Expression{System.Func{``0,System.Object}}},MongoDbGenericRepository.Models.IndexCreationOptions,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.DropIndexAsync``1(System.String,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.DropIndexAsync``2(System.String,System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.GetIndexesNamesAsync``1(System.String)">
<inheritdoc />
</member>
<member name="M:MongoDbGenericRepository.BaseMongoRepository.GetIndexesNamesAsync``2(System.String)">
<inheritdoc />
</member>
<member name="T:MongoDbGenericRepository.Models.Document"> <member name="T:MongoDbGenericRepository.Models.Document">
<summary> <summary>
This class represents a basic document that can be stored in MongoDb. This class represents a basic document that can be stored in MongoDb.
@@ -1634,6 +1844,81 @@
Your document must implement this class in order for the MongoDbRepository to handle them. Your document must implement this class in order for the MongoDbRepository to handle them.
</summary> </summary>
</member> </member>
<member name="T:MongoDbGenericRepository.Models.IndexCreationOptions">
<summary>
Options for creating an index.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Unique">
<summary>
Gets or sets a value indicating whether the index is a unique index.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.TextIndexVersion">
<summary>
Gets or sets the index version for text indexes.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.SphereIndexVersion">
<summary>
Gets or sets the index version for 2dsphere indexes.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Sparse">
<summary>
Gets or sets a value indicating whether the index is a sparse index.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Name">
<summary>
Gets or sets the index name.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Min">
<summary>
Gets or sets the min value for 2d indexes.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Max">
<summary>
Gets or sets the max value for 2d indexes.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.LanguageOverride">
<summary>
Gets or sets the language override.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.ExpireAfter">
<summary>
Gets or sets when documents expire (used with TTL indexes).
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.DefaultLanguage">
<summary>
Gets or sets the default language.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.BucketSize">
<summary>
Gets or sets the size of a geohash bucket.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Bits">
<summary>
Gets or sets the precision, in bits, used with geohash indexes.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Background">
<summary>
Gets or sets a value indicating whether to create the index in the background.
</summary>
</member>
<member name="P:MongoDbGenericRepository.Models.IndexCreationOptions.Version">
<summary>
Gets or sets the version of the index.
</summary>
</member>
<member name="T:MongoDbGenericRepository.Models.IPartitionedDocument"> <member name="T:MongoDbGenericRepository.Models.IPartitionedDocument">
<summary> <summary>
This class represents a document that can be inserted in a collection that can be partitioned. This class represents a document that can be inserted in a collection that can be partitioned.