Is it possible get feed on the logical partition instead of whole container

Thangavel Daniel Tamilarasan 271 Reputation points
2022-10-20T13:04:44.347+00:00

Hi

Is it possible get feed on the logical partition instead of whole container in Azure function ?

        [Function("CosmosTrigger1")]  
        public void Run([CosmosDBTrigger(  
            databaseName: "db_test",  
            collectionName: "testcontainer",  
            ConnectionStringSetting = "db_DOCUMENTDB",  
            LeaseCollectionName = "leases",  
            CreateLeaseCollectionIfNotExists =true)] IReadOnlyList<MyDocument> input)  
        {  
            if (input != null && input.Count > 0)  
            {  
                _logger.LogInformation("Documents modified: " + input.Count);  
                _logger.LogInformation("First document Id: " + input[0].Id);  
            }  
        }  

Please suggest

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,972 questions
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,628 questions
0 comments No comments
{count} votes

Accepted answer
  1. MuthuKumaranMurugaachari-MSFT 22,316 Reputation points
    2022-10-20T17:56:32.33+00:00

    @Thangavel Daniel Tamilarasan Thank you for reaching out to Microsoft Q&A. Unfortunately, Change Feed for a partition is not possible using Functions Trigger.

    Azure Functions use Change Feed Processor (refer https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/change-feed-functions) which doesn't support reading from a single partition. Check docs for the below info:

    252557-image.png

    If you are in need of this feature, I would recommend you submit feedback directly with Cosmos DB product team via Azure Cosmos DB feedback. Others can also upvote the feature with similar interests. Alternatively, you can explore Change feed pull model which supports reading changes from a particular partition key and let us know if any questions.

    I hope this answers your question and feel free to add a comment if you have any other questions. We would be happy to assist you. Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.