diff --git a/Microsoft.Azure.Cosmos/src/FeedRange/FeedRanges/FeedRangePartitionKey.cs b/Microsoft.Azure.Cosmos/src/FeedRange/FeedRanges/FeedRangePartitionKey.cs index d832b7ce34..0b73a1a349 100644 --- a/Microsoft.Azure.Cosmos/src/FeedRange/FeedRanges/FeedRangePartitionKey.cs +++ b/Microsoft.Azure.Cosmos/src/FeedRange/FeedRanges/FeedRangePartitionKey.cs @@ -75,7 +75,15 @@ internal override Task AcceptAsync( TArg argument, CancellationToken cancellationToken) => visitor.VisitAsync(this, argument, cancellationToken); - public override string ToString() => this.PartitionKey.InternalKey.ToJsonString(); + public override string ToString() + { + if (this.PartitionKey.IsNone) + { + return "None"; + } + + return this.PartitionKey.InternalKey.ToJsonString(); + } internal override TResult Accept(IFeedRangeTransformer transformer) { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs index e3b0c9ea04..ca6f1495f5 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs @@ -2527,6 +2527,18 @@ public async Task ReadNonPartitionItemAsync() } } + //use ReadFeed on fixed container with CosmosContainerSettings.NonePartitionKeyValue. + using (FeedIterator feedIterator = fixedContainer.GetItemQueryIterator( + queryText: null, + requestOptions: new QueryRequestOptions() { MaxItemCount = 10, PartitionKey = Cosmos.PartitionKey.None, })) + { + while (feedIterator.HasMoreResults) + { + FeedResponse readFeedResponse = await feedIterator.ReadNextAsync(); + Assert.AreEqual(2, readFeedResponse.Count()); + } + } + //Quering items on fixed container with non-none PK. using (FeedIterator feedIterator = fixedContainer.GetItemQueryIterator( sql, @@ -2539,6 +2551,18 @@ public async Task ReadNonPartitionItemAsync() } } + //ReadFeed on on fixed container with non-none PK. + using (FeedIterator feedIterator = fixedContainer.GetItemQueryIterator( + queryText: null, + requestOptions: new QueryRequestOptions() { MaxItemCount = 10, PartitionKey = new Cosmos.PartitionKey(itemWithPK.partitionKey) })) + { + while (feedIterator.HasMoreResults) + { + FeedResponse readFeedResponse = await feedIterator.ReadNextAsync(); + Assert.AreEqual(1, readFeedResponse.Count()); + } + } + //Deleting item from fixed container with CosmosContainerSettings.NonePartitionKeyValue. ItemResponse deleteResponseWithoutPk = await fixedContainer.DeleteItemAsync( partitionKey: Cosmos.PartitionKey.None,