How to configure the extension for Azure Cosmos DB for MongoDB?
-
We want to use the Azure Cosmos DB for MongoDB for storage.
Can you please guide us on how to set up the configuration for the Azure Cosmos DB with MongoDB?
-
CosmosDB isn't fully compatible with the mongodb API.
You will need to explicitly create indexes everywhere you get errorThe index path corresponding to the specified order-by item is excluded.
.The following should make basic things working:
db.getCollection("assets").createIndex({ name: 1 }) db.getCollection("components").createIndex({ name: 1 }) db.getCollection("data").createIndex({ name: 1 }) db.getCollection("folders").createIndex({ name: 1 }) db.getCollection("schedules").createIndex({ name: 1 }) db.getCollection("scripts").createIndex({ name: 1 }) db.getCollection("tags").createIndex({ name: 1 }) db.getCollection("templates").createIndex({ name: 1 }) db.getCollection("versions").createIndex({ name: 1 }) db.getCollection("profiles").createIndex({ timeout: 1, timestamp: 1 })
-
Thanks, Jan!
It is working now. You said these changes should make basic things work. But are there any other functionalities which may not work?
Also, are you planning to roll out the update supporting CosmosDB?
Edit:
We are getting some errors on import.
Please refer to the following image:error text:
Import failed: Unable to insert an entity (folders) "/ReportsCollection" during the import: MongoServerError: Error=2, Details='Response status code does not indicate success: BadRequest (400); Substatus: 1101; ActivityId: 8f068b1f-9b6c-41e4-a48f-c9c12b793cf6; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 1101; ActivityId: 8f068b1f-9b6c-41e4-a48f-c9c12b793cf6; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 1101; ActivityId: 8f068b1f-9b6c-41e4-a48f-c9c12b793cf6; Reason: (Message: {"Errors":["Transaction is not active"]}
ActivityId: 8f068b1f-9b6c-41e4-a48f-c9c12b793cf6, Request URI: /apps/cd280409-22c8-467c-9159-1821542f88f0/services/368c94b9-3d77-496f-8fb4-82af47de27fd/partitions/436ce031-60d7-4cc2-a6df-75b0b2a1aa15/replicas/133459356068600116p/, RequestStats: Microsoft.Azure.Cosmos.Tracing.TraceData.ClientSideRequestStatisticsTraceDatum, SDK: Windows/10.0.17763 cosmos-netstandard-sdk/3.18.0););); MongoServerError: Import failed: Unable to insert an entity (folders) "/ReportsCollection" during the import: MongoServerError: Error=2, Details='Response status code does not indicate success: BadRequest (400); Substatus: 1101; ActivityId: 8f068b1f-9b6c-41e4-a48f-c9c12b793cf6; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 1101; ActivityId: 8f068b1f-9b6c-41e4-a48f-c9c12b793cf6; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 1101; ActivityId: 8f068b1f-9b6c-41e4-a48f-c9c12b793cf6; Reason: (Message: {"Errors":["Transaction is not active"]}
ActivityId: 8f068b1f-9b6c-41e4-a48f-c9c12b793cf6, Request URI: /apps/cd280409-22c8-467c-9159-1821542f88f0/services/368c94b9-3d77-496f-8fb4-82af47de27fd/partitions/436ce031-60d7-4cc2-a6df-75b0b2a1aa15/replicas/133459356068600116p/, RequestStats: Microsoft.Azure.Cosmos.Tracing.TraceData.ClientSideRequestStatisticsTraceDatum, SDK: Windows/10.0.17763 cosmos-netstandard-sdk/3.18.0);););
at Connection.onMessage (/app/node_modules/mongodb/lib/cmap/connection.js:202:26)
at MessageStream.<anonymous> (/app/node_modules/mongodb/lib/cmap/connection.js:61:60)
at MessageStream.emit (node:events:514:28)
at MessageStream.emit (node:domain:489:12)
at processIncomingData (/app/node_modules/mongodb/lib/cmap/message_stream.js:124:16)
at MessageStream._write (/app/node_modules/mongodb/lib/cmap/message_stream.js:33:9)
at writeOrBuffer (node:internal/streams/writable:392:12)
at _write (node:internal/streams/writable:333:10)
at Writable.write (node:internal/streams/writable:337:10)
at TLSSocket.ondata (node:internal/streams/readable:766:22)Message in VS Code:
warn: Unable to insert an entity (folders) "/ReportsCollection" during the import: MongoServerError: Error=2, Details='Response status code does not indicate success: BadRequest (400); Substatus: 1101;
ActivityId: 8f068b1f-9b6c-41e4-a48f-c9c12b793cf6; Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 1101; ActivityId: 8f068b1f-9b6c-41e4-a48f-c9c12b793cf6;
Reason: (Response status code does not indicate success: BadRequest (400); Substatus: 1101;
ActivityId: 8f068b1f-9b6c-41e4-a48f-c9c12b793cf6; Reason: (Message: {"Errors":["Transaction is not active"]}
ActivityId: 8f068b1f-9b6c-41e4-a48f-c9c12b793cf6,
-
We are getting some errors on import.
Try to disable transactions
"store": { "provider": "mongodb", "transactions": { "enabled": false } }
But are there any other functionalities which may not work?
I don't know, we never tried cosmosdb in prod with jsreport. Try to deeply test it and post back if you reach something.
Also, are you planning to roll out the update supporting CosmosDB?
Not so far as it isn't a common use case. But please share your results and we will try to help.
Note we will add indexes by default which should help with cosmodb
https://github.com/jsreport/jsreport/issues/1113
-
This post is deleted!
-
Hi,
Now the report is getting generated but we are facing a slowness issue. The report with MongoDB storage gets generated within 3 seconds whereas the same report with CosmosDB takes almost 39 seconds for generation.
Please check the following logs:
-
Maybe its your connection to the cosmosdb?
jsreport operates typically only with hundreds of entities/rows/documents therefore there isn't much to do regarding the optimization.
If you email me export of your workspace, I will try to run a template and compare the speed with you.
-
Hi Jan,
I have mailed you the workspace and log files for the same workspace with MongoDB and CosmosDB each as storage. Please help us with the slowness issue.
We had a few queries:
-
Does the Cluster's region affect the performance?
-
As the template and file count increase in the storage, will there be slowness in rendering reports?
-