Tag: 文档数据库

使用Node.js将嵌套文档插入到DocumentDB文档中

将嵌套文档插入到下面的最佳方法是什么? { "id": "3af62b94-2031-4b85-9fd3-e13e7217d382", "Email": "test@ingeniuus.com", "Name": "test", "OrgRoles": null, "UpdatedDate": "2017-11-10T10:49:11.1962998Z", "CreatedDate": "2017-11-10T10:49:05.6247018Z", "IsDeleted": true, "_rid": "KFokAOUDHwEtAAAAAAAAAA==", "_self": "dbs/KFokAA==/colls/KFokAOUDHwE=/docs/KFokAOUDHwEtAAAAAAAAAA==/", "_etag": "\"00001e00-0000-0000-0000-5a0584270000\"", "_attachments": "attachments/", "_ts": 1510310951 } 理想情况下,我想追加OrgRoles,以便文档看起来像: { "id": "3af62b94-2031-4b85-9fd3-e13e7217d382", "Email": "test@ingeniuus.com", "Name": "test", "OrgRoles": null, "Devices": [ "ID": "765476547", "name": "myDevice" ], "UpdatedDate": "2017-11-10T10:49:11.1962998Z", "CreatedDate": "2017-11-10T10:49:05.6247018Z", "IsDeleted": true, "_rid": "KFokAOUDHwEtAAAAAAAAAA==", "_self": "dbs/KFokAA==/colls/KFokAOUDHwE=/docs/KFokAOUDHwEtAAAAAAAAAA==/", "_etag": […]

使用Azure Mobile Apps for Node在Cosmos数据库上执行SQL查询连接

目前,我正在为使用Azure移动应用程序和Node.js和Azure Cosmos DB(文档数据库)开发移动系统的后端。 我使用的是这里给出的例子: https://github.com/Azure/azure-mobile-apps-node/blob/master/samples/custom-api-sql-stmt/api/completeall.js 到目前为止这么好 – 但是,每当我运行这个SQL,我得到: TypeError: provider.read is not a function at Function.module.exports.api.execute (x:\x\node_modules\azure-mobile-apps\src\data\index.js:32:18 我需要运行的SQL如下所示: SELECT c.id, c.Email FROM Profile c JOIN d in c.DeviceIDs WHERE d.DeviceID = @deviceId 这是因为我的数据是嵌套的,就像这样(Cosmos中的Profile集合) – 我需要获取DeviceID匹配的logging: [ { "id": "2ca572d0-858d-4376-8537-c228a8379638", "Email": "test@user.com", "Name": "Test User 1", "OrgRoles": null, "DeviceIDs": [ { "DeviceID": "123445555555", "DeviceCode": "1234" } […]