azure-cosmosdb

Understanding the x-ms-resource-usage in DocumentDB response header

吃可爱长大的小学妹 提交于 2019-12-19 19:48:24
问题 While performing a simple Get operation by Id where a single document is returned (not an array with one document) I get the following x-ms-resource-usage: x-ms-resource-usage:documentSize:0;documentsSize:288;collectionSize=307; Questions: Why is documentSize 0? What is the unit of measure? Bytes? What is the difference between documentSize and documentsSize ? Please note the query only returns one document. What is the collectionSize ? Is that the total number of documents in the collection?

GridFS support in MongoAPI of Azure DocumentDB

雨燕双飞 提交于 2019-12-18 17:26:16
问题 I am using the MongoDB API for DocumentDB via the GridFsTemplate from springdata in JAVA. I am getting an error when trying to use the GridFS part of MongoDB to manage large files. I am able to create a file (I think) and find its metadata, but I cannot retrieve the file contents. The following error is returned: Error: error: { "_t" : "OKMongoResponse", "ok" : 0, "code" : 8, "errmsg" : "The value '/media/7hsUAJOI2QsBAAAAAAAAAEeWwrcB' specified for query '$resolveFor' is invalid.\r

How to find duplicates in a nested array in cosmos db without GROUP BY and COUNT

空扰寡人 提交于 2019-12-18 09:33:52
问题 I am trying to find duplicates in a nested object in a collection. In ye olde SQL, I would do this with some sort of GROUP BY and a COUNT. Cosmos DB doesn't support GROUP BY (as far as I can see) so I am trying to find a work around. One limitation is that I only have access to the data explorer in the azure portal (Don't ask). To explain in more detail, suppose you have a collection like the following. Note that the first item has a duplicate in the "stuff" collection: [ { "id": "1", "Name":

Alternative to group by for cosmos db

偶尔善良 提交于 2019-12-18 08:13:30
问题 Given that cosmos db does not support group by, what is a good alternative to achieve similar functionality: Select sum(*) , groupterm from tble group by groupterm Can I efficiently achieve this in a cosmos stored procedure? 回答1: Group by is now supported in Cosmos db SQL API. You will be needing SDK version 3.3 or higher Azure Cosmos DB currently supports GROUP BY in .NET SDK 3.3 or later. Support for other language SDK's and the Azure Portal is not currently available but is planned. https:

How can I store Images in Azure Cosmos DB?

懵懂的女人 提交于 2019-12-18 07:40:35
问题 I have PNG images which i want to store in cosmos db along with some metadata. What is the best way to store it ? I dont want to store in Azure bolb storage separately, better to store with the data. 回答1: If you want to store images directly to the cosmos db, you can use DocumentClient.CreateAttachmentAsync method to store it directly. using (FileStream fileStream = new FileStream(@".\something.pdf", FileMode.Open)) { //Create the attachment Attachment attachment = await client

DateTime, the Epoch and DocumentDb

∥☆過路亽.° 提交于 2019-12-18 06:30:30
问题 So I read this very interesting blog on working with datetime in Azure DocumentDb. The problem being that, right now, Azure DocumentDb does not support range search on datetime fields. The reason for that is that DocumentDb is based on json and that has no datetime type, therefore one usually puts it in a string of xml datetime format. (obviously Mongo does not have that issue, it's bson format adds the datetime type (among others)) Anyway, the article describes storing the datetime in json

How to solve MongoError: pool destroyed while connecting to CosmosDB

拈花ヽ惹草 提交于 2019-12-18 04:45:05
问题 I have Node.js service in which I am using mongo-API to communicate with Document/Cosmos DB. My service run's fine and performs all the crud operation but after 1 min some mongo error throws from the service. /document-db-service/node_modules/mongodb/lib/utils.js:123 process.nextTick(function() { throw err; }); ^ MongoError: pool destroyed at Pool.write (/document-db-service/node_modules/mongodb-core/lib/connection/pool.js:922:12) at Cursor._find (/document-db-service/node_modules/mongodb

DocumentDB: Removing default indexing

我怕爱的太早我们不能终老 提交于 2019-12-18 04:23:15
问题 I am trying to remove the default indexes which are created for a new collection: { "indexingMode": "lazy", "automatic": true, "includedPaths": [ { "path": "/*", "indexes": [ { "kind": "Range", "dataType": "Number", "precision": -1 }, { "kind": "Hash", "dataType": "String", "precision": 3 } ] }, { "path": "/\"_ts\"/?", "indexes": [ { "kind": "Range", "dataType": "Number", "precision": -1 }, { "kind": "Hash", "dataType": "String", "precision": 3 } ] } ], "excludedPaths": [] } As far as I

What are the differences between CosmoDB and DocumentDB

此生再无相见时 提交于 2019-12-18 03:55:12
问题 As far as I can work out, CosmoDB has the ability to make Graph queries using the Gremlin query language. Apart from that the pricing, marketing etc. all seem the same. It seems strange that they came up with a new product to add Gremlin when they didn't do the same to add MongoDB support. What are the discernable differences between these two products? 回答1: The Azure Cosmos DB team member here. Azure Cosmos DB started as “Project Florence” in 2010 to address developer pain-points faced by

What are the differences between CosmoDB and DocumentDB

六月ゝ 毕业季﹏ 提交于 2019-12-18 03:54:01
问题 As far as I can work out, CosmoDB has the ability to make Graph queries using the Gremlin query language. Apart from that the pricing, marketing etc. all seem the same. It seems strange that they came up with a new product to add Gremlin when they didn't do the same to add MongoDB support. What are the discernable differences between these two products? 回答1: The Azure Cosmos DB team member here. Azure Cosmos DB started as “Project Florence” in 2010 to address developer pain-points faced by