我正在使用Power Document的"Document DB connector"作为数据源.由于文档数据库的限制(日期没有本机支持),我们以UNIX格式(自1970年以来的秒数)存储日期,允许对文档数据库写入日期范围查询.
问题是在Power BI端将其转换回日期.我正在寻找创建Computed列的可能性,它将把纪元时间转换为日期.否则,我们将被迫以两种看起来多余的格式写入Document DB.
下一个SP是对集合中所有文档进行计数的豁免,并且通常学习如何处理完整集合.
由于某种原因,下一个SP返回
{ "计数":0, "QueryCount":0}
虽然我希望它能回来
{"count":1000,"QueryCount":1}
SP:
function CountAll(continuationToken) {
var collection = getContext().getCollection();
var results =0;
var queryCount = 0;
var pageSize = 1000;
var responseOptionsContinuation;
var accepted = true;
var responseOptions = { continuation: continuationToken, pageSize : pageSize};
if (accepted) {
accepted = collection.readDocuments(collection.getSelfLink(), responseOptions, onReadDocuments);
responseOptions.continuation = responseOptionsContinuation;
}
setBody();
function onReadDocuments(err, docFeed, responseOptions) {
queryCount++;
if (err) {
throw 'Error while reading document: ' + err;
}
results += docFeed.length;
responseOptionsContinuation = responseOptions.continuation;
}
function …Run Code Online (Sandbox Code Playgroud) 我在Azure上有一个文档数据库数据库。当我存档用户记录及其所有数据时,我会遇到一个特别繁重的查询。
我正在执行S1计划,并且会遇到一个异常,表明我已达到RU / s的极限。S1计划有250个。
我决定切换到“标准”计划,该计划可让您设置RU / s并为此付费。
我将其设置为500 RU / s。
我进行了相同的查询,然后回头查看了监视图表。
在我进行此最新查询测试时,它说我做了226个请求,其中有10个受到限制。
这是为什么?我将其设置为500 RU / s。顺便说一下,查询失败了。
我使用 Azure DocumentDB 来存储一些键值对。这是我使用的文档的结构
{
"Key": "Deleted",
"Value": {
"email": "abc@cdf.com"
}
}
Run Code Online (Sandbox Code Playgroud)
当我像这样编写 DocumentDB 查询时,
SELECT C.Value FROM C
Run Code Online (Sandbox Code Playgroud)
此查询不起作用。这是我收到的错误消息。
Syntax error, incorrect syntax near 'Value'.
Run Code Online (Sandbox Code Playgroud)
但是这个查询工作正常,
SELECT C.Key FROM C
Run Code Online (Sandbox Code Playgroud)
我知道 ' Value' 应该是 azure documentdb 中的关键字。我该如何查询?
我的文档中有以下结果.我想更新"类型"和"锻炼"的属性值,这样它不会影响其他值
"PartyId": 10114795,
"WorkoutId": 4,
"Type": "heart-rate-zone-target",
"DateStarted": "2016-02-05T18:14:15.1620890Z",
"id": "0c44d1ee-58b8-4083-a702-f770ba0e63e9",
"_rid": "0ThoANQ4YwEEAAAAAAAAAA==",
"_self": "dbs/0ThoAA==/colls/0ThoANQ4YwE=/docs/0ThoANQ4YwEEAAAAAAAAAA==/",
"_etag": "\"08000130-0000-0000-0000-58dd72da0000\"",
"_attachments": "attachments/",
"_ts": 1490907866
Run Code Online (Sandbox Code Playgroud) 我在cosmosdb中使用查询浏览器搜索多边形内的点,此示例中的多边形就是这个(可以在geojson.io中看到)
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry":{
"type":"Polygon",
"coordinates":
[[[-107.44131585954042, 24.801824950217672],
[-107.43361255454303, 24.801824950217672],
[-107.43361255454303, 24.791345071112183],
[-107.44131585954042, 24.791345071112183],
[-107.44131585954042, 24.801824950217672]]]
},
"properties": {
"name": "The Polygon"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-107.437779, 24.798064]
},
"properties": {
"name": "The point inside the polygon"
}
},
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [-107.39355, 24.792837]
},
"properties": {
"name": "The point offside the polygon"
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
但是当我在查询浏览器中搜索时,cosmosdb检索到了这两点,这是我的查询
SELECT * FROM …Run Code Online (Sandbox Code Playgroud) 我使用Microsoft.Azure.Graphs库连接到Cosmos数据库实例并查询图数据库.
我正在尝试优化我的Gremlin查询,以便只选择我只需要的那些属性.但是,我不知道如何选择从边和顶点中选择哪些属性.
假设我们从这个查询开始:
gremlin> g.V().hasLabel('user').
project('user', 'edges', 'relatedVertices')
.by()
.by(bothE().fold())
.by(both().fold())
Run Code Online (Sandbox Code Playgroud)
这将返回以下内容:
{
"user": {
"id": "<userId>",
"type": "vertex",
"label": "user",
"properties": [
// all vertex properties
]
},
"edges": [{
"id": "<edgeId>",
"type": "edge",
"label": "<edgeName>",
"inV": <relatedVertexId>,
"inVLabel": "<relatedVertexLabel>",
"outV": "<relatedVertexId>",
"outVLabel": "<relatedVertexLabel>"
"properties": [
// edge properties, if any
]
}],
"relatedVertices": [{
"id": "<vertexId>",
"type": "vertex",
"label": "<relatedVertexLabel>",
"properties": [
// all related vertex properties
]
}]
}
Run Code Online (Sandbox Code Playgroud)
现在假设我们只从我们命名为"User"的根顶点获取一些属性:
gremlin> g.V().hasLabel('user').
project('id', 'prop1', 'prop2', 'edges', 'relatedVertices') …Run Code Online (Sandbox Code Playgroud) 我正在使用 ASP.NET Core 和 Cosmos DB 构建一个宁静的 API。有一个需要分区键的 GetItemById 请求。
public static async Task<T> GetItemAsync(string itemId, string name)
{
try
{
Document document =
await client.ReadDocumentAsync(UriFactory.CreateDocumentUri(DatabaseId, CollectionId, itemId),
new RequestOptions() { PartitionKey = new PartitionKey(name) });
return (T)(dynamic)document;
}
catch (DocumentClientException e)
{
if (e.StatusCode == System.Net.HttpStatusCode.NotFound)
{
return null;
}
else
{
throw;
}
}
}
Run Code Online (Sandbox Code Playgroud)
GetByIdAsync() 函数调用此 GetItemAsync() 方法。
[HttpGet("{itemId}")]
public async Task<IActionResult> GetByIdAsync(string itemId, string name)
{
var item = await DocumentDBRepository<TodoItem>.GetItemAsync(itemId, name);
if (item == null) …Run Code Online (Sandbox Code Playgroud) 我正在尝试查询一些文档的集合,其中某些字段之一恰好被命名为“ top”。但是,我不能在select语句中直接引用此列,因为名称与TOP关键字冲突。例如:
SELECT C.code, C.top FROM c
Run Code Online (Sandbox Code Playgroud)
这将引发以下错误-“语法错误,'top'附近的语法不正确”。
我可以做些什么来转义该字段名称,还是必须将该字段重命名为其他名称?
我正在尝试在C#中构建Azure函数,如果还没有ID,则使用SQL API在Azure cosmos DB中创建一个新的文档对象,并更新一个已经存在的文档对象。
其背后的上下文是将聊天机器人对话历史记录到唯一的用户会话中。
输入:
带有参数(id(字符串),chatHistory(字符串)和chatDateTime(字符串))的HTTP GET请求
输出:
如果已经存在具有相同ID的文档对象,则使用输入chatHisotry和chatDateTime更新文档。
如果不存在具有相同ID的文档对象,则创建一个ID,chatHistory和chatDateTime等于输入的新文档对象。
任何帮助,不胜感激!挣扎了几天。
文档对象示例:
{
"id": "ESCRfAKwlTbH8W5aVRLxgA",
"chatHistory": "Hi, Hello",
"chatDateTime": "Fri Sep 21 2018 05:34:35 GMT+0000 (Coordinated Universal Time)",
"_rid": "RwYSAIqaSVg2AAAAAAAAAA==",
"_self": "dbs/RwYSAA==/colls/RwYSAIqaSVg=/docs/RwYSAIqaSVg2AAAAAAAAAA==/",
"_etag": "\"00007400-0000-0000-0000-5ba482ed0000\"",
"_attachments": "attachments/",
"_ts": 1537508077
}
Run Code Online (Sandbox Code Playgroud) azure-cosmosdb ×10
azure ×7
c# ×2
.net ×1
api ×1
asp.net-core ×1
document ×1
function ×1
gremlin ×1
powerbi ×1
throttling ×1