Cosmos MongoDb Write error: Schema owner id in the header does not match current collection id

RichLevy-0891 5 Reputation points
2023-02-22T16:02:37.32+00:00

During a Mongo Insert I'm seeing the following Write Error:

"Schema owner id in the header does not match current collection id"

I've searched everywhere but cannot find any information on this error. The collection I'm writing into has a unique composite index comprised of 2 strings and 1 integer.

Unique index definition:

db.EODResultsContainer.createIndex( 
        { 
            "Key1": 1,
            "Key2": 1,
            "businessDate": 1
        },
        {
            unique: true
        } 
    )

Here is the stack:

MongoDB.Driver.MongoWriteException: A write operation resulted in an error. WriteError: { Category : "Uncategorized", Code : 2, Message : "Error=2, Details='Response status code does not indicate success: BadRequest (400); Substatus: 1016; ActivityId: 0e8535e7-286b-45a7-a2fc-a55e2641ad4c; Reason: (Message: {"Errors":["Schema owner id in the header does not match current collection id"]}
ActivityId: 0e8535e7-286b-45a7-a2fc-a55e2641ad4c, Request URI: /apps/xxxx/services/yyyy/partitions/zzzz/replicas/133210782093189108p/, RequestStats: Microsoft.Azure.Cosmos.Tracing.TraceData.ClientSideRequestStatisticsTraceDatum, SDK: Windows/10.0.17763 cosmos-netstandard-sdk/3.18.0);" }.
 ---> MongoDB.Driver.MongoBulkWriteException`1[Results.Containers.EODResultsContainer]: A bulk write operation resulted in one or more errors. WriteErrors: [ { Category : "Uncategorized", Code : 2, Message : "Error=2, Details='Response status code does not indicate success: BadRequest (400); Substatus: 1016; ActivityId: 0e8535e7-286b-45a7-a2fc-a55e2641ad4c; Reason: (Message: {"Errors":["Schema owner id in the header does not match current collection id"]}
ActivityId: 0e8535e7-286b-45a7-a2fc-a55e2641ad4c, Request URI: /appsxxxx/services/yyyy/partitions/zzzz/replicas/kkkk/, RequestStats: Microsoft.Azure.Cosmos.Tracing.TraceData.ClientSideRequestStatisticsTraceDatum, SDK: Windows/10.0.17763 cosmos-netstandard-sdk/3.18.0);" } ].
   at MongoDB.Driver.MongoCollectionImpl`1.BulkWrite(IClientSessionHandle session, IEnumerable`1 requests, BulkWriteOptions options, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl`1.<>c__DisplayClass28_0.<BulkWrite>b__0(IClientSessionHandle session)
   at MongoDB.Driver.MongoCollectionImpl`1.UsingImplicitSession[TResult](Func`2 func, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl`1.BulkWrite(IEnumerable`1 requests, BulkWriteOptions options, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionBase`1.<>c__DisplayClass68_0.<InsertOne>b__0(IEnumerable`1 requests, BulkWriteOptions bulkWriteOptions)
   at MongoDB.Driver.MongoCollectionBase`1.InsertOne(TDocument document, InsertOneOptions options, Action`2 bulkWrite)
   --- End of inner exception stack trace ---
   at MongoDB.Driver.MongoCollectionBase`1.InsertOne(TDocument document, InsertOneOptions options, Action`2 bulkWrite)
   at MongoDB.Driver.MongoCollectionBase`1.InsertOne(TDocument document, InsertOneOptions options, CancellationToken cancellationToken)
Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,906 questions
{count} vote

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.