diff --git a/CosmosClone/CosmicCloneUI/SourcePage.xaml b/CosmosClone/CosmicCloneUI/SourcePage.xaml
index 16ccce5..a30ebc4 100644
--- a/CosmosClone/CosmicCloneUI/SourcePage.xaml
+++ b/CosmosClone/CosmicCloneUI/SourcePage.xaml
@@ -16,6 +16,7 @@
+
@@ -38,10 +39,13 @@
-
+
+
+
+
-
+
diff --git a/CosmosClone/CosmicCloneUI/SourcePage.xaml.cs b/CosmosClone/CosmicCloneUI/SourcePage.xaml.cs
index 8ce0b49..b408706 100644
--- a/CosmosClone/CosmicCloneUI/SourcePage.xaml.cs
+++ b/CosmosClone/CosmicCloneUI/SourcePage.xaml.cs
@@ -41,7 +41,8 @@ public bool TestSourceConnection()
EndpointUrl = SourceURL.Text.ToString(),
AccessKey = SourceKey.Text.ToString(),
DatabaseName = SourceDB.Text.ToString(),
- CollectionName = SourceCollection.Text.ToString()
+ CollectionName = SourceCollection.Text.ToString(),
+ SelectQuery = SelectQuery.Text.ToString()
};
var result = cosmosHelper.TestSourceConnection();
diff --git a/CosmosClone/CosmosCloneCommon/Migrator/DocumentMigrator.cs b/CosmosClone/CosmosCloneCommon/Migrator/DocumentMigrator.cs
index 7fdc9f5..47309f0 100644
--- a/CosmosClone/CosmosCloneCommon/Migrator/DocumentMigrator.cs
+++ b/CosmosClone/CosmosCloneCommon/Migrator/DocumentMigrator.cs
@@ -134,7 +134,7 @@ public async Task InitializeMigration()
{
TotalRecordsInSource = cosmosHelper.GetSourceRecordCount();
logger.LogInfo($"Total records in Source: {TotalRecordsInSource} ");
- SourceCommonDataFetchQuery = cosmosHelper.GetSourceEntityDocumentQuery(sourceClient, CloneSettings.ReadBatchSize);
+ SourceCommonDataFetchQuery = cosmosHelper.GetSourceEntityDocumentQuery(sourceClient, CloneSettings.SourceSettings.SelectQuery, CloneSettings.ReadBatchSize);
await cosmosBulkImporter.InitializeBulkExecutor(targetClient, targetCollection);
}
else
diff --git a/CosmosClone/CosmosCloneCommon/Utility/CloneSettings.cs b/CosmosClone/CosmosCloneCommon/Utility/CloneSettings.cs
index 0eae3c1..b01cc19 100644
--- a/CosmosClone/CosmosCloneCommon/Utility/CloneSettings.cs
+++ b/CosmosClone/CosmosCloneCommon/Utility/CloneSettings.cs
@@ -95,6 +95,7 @@ public class CosmosCollectionValues
public string AccessKey { get; set; }
public string DatabaseName { get; set; }
public string CollectionName { get; set; }
+ public string SelectQuery { get; set; }
public int OfferThroughputRUs { get; set; }
}
}
diff --git a/CosmosClone/CosmosCloneCommon/Utility/CosmosDBHelper.cs b/CosmosClone/CosmosCloneCommon/Utility/CosmosDBHelper.cs
index be06081..45b8ea8 100644
--- a/CosmosClone/CosmosCloneCommon/Utility/CosmosDBHelper.cs
+++ b/CosmosClone/CosmosCloneCommon/Utility/CosmosDBHelper.cs
@@ -273,7 +273,7 @@ public async Task CreateTargetDocumentCollection(DocumentCli
}
}
- public IQueryable GetSourceEntityDocumentQuery(DocumentClient sourceClient, int batchSize = -1)
+ public IQueryable GetSourceEntityDocumentQuery(DocumentClient sourceClient, string selectQuery, int batchSize = -1)
{
try
{
@@ -281,8 +281,7 @@ public IQueryable GetSourceEntityDocumentQuery(DocumentClient sourceClient
string sourceDatabaseName = CloneSettings.SourceSettings.DatabaseName;
string sourceCollectionName = CloneSettings.SourceSettings.CollectionName;
FeedOptions queryOptions = new FeedOptions { MaxItemCount = batchSize, EnableCrossPartitionQuery = true };
- string EntityDataQuery = $"SELECT * FROM c";
- var documentQuery = sourceClient.CreateDocumentQuery(UriFactory.CreateDocumentCollectionUri(sourceDatabaseName, sourceCollectionName), EntityDataQuery, queryOptions);
+ var documentQuery = sourceClient.CreateDocumentQuery(UriFactory.CreateDocumentCollectionUri(sourceDatabaseName, sourceCollectionName), selectQuery, queryOptions);
return documentQuery;
}
catch (Exception ex)