我想要做的是:
{
"name": "Document 1",
"includes": [
{
"name": "Document 2.1"
"includes": [
{
"name": "Document 3",
"includes": []
}
]
},
{
"name": "Document 2.2",
"includes": []
}
]
}设置的当前状态:
问题:
g.addV('person').property('id', 'thomas').property('firstName', 'Thomas').property('age', 44).property('userid', 1)创建顶点,但是像g.addV({ firstName: 'Thomas' })这样的东西似乎不起作用。示例遍历查询:
g.V('03e0576f-2ff7-6109-5ed5-237b43191354').repeat(out('includes')).until(not(out('includes'))).simplePath().dedup().tree().by('id')
此查询的结果:
[{
"03e0576f-2ff7-6109-5ed5-237b43191354": {
"key": "03e0576f-2ff7-6109-5ed5-237b43191354",
"value": {
"7fab4007-c80c-ba21-f5d3-8eb353ea3279": {
"key": "7fab4007-c80c-ba21-f5d3-8eb353ea3279",
"value": {
"eec55fbd-6900-130d-247f-fb437b093711": {
"key": "eec55fbd-6900-130d-247f-fb437b093711",
"value": {}
},
"cfd14a8c-1ac3-6cc3-e2a4-ac3f250478e1": {
"key": "cfd14a8c-1ac3-6cc3-e2a4-ac3f250478e1",
"value": {
"acac136a-3bd4-831c-df6e-e5b95e593b9a": {
"key": "acac136a-3bd4-831c-df6e-e5b95e593b9a",
"value": {}
}
}
}
}
}
}
}
}]发布于 2017-06-28 12:41:44
是的,可以通过Graph和Document插入文档。但是,Cosmos希望为文档提供一种特定的GraphSON格式,以便在遍历图时获取它们的所有属性。
我建议查看Tinkerpop文档中的顶点性质和GraphSON,以便更好地了解这些主题。
通过Gremlin添加文档时,语法为要添加的所有属性分隔的名称值逗号。试试这个:
g.addV('label', 'human', 'name', 'jesse', 'age', 27)现在,如果您转到Azure门户并执行一个SQL查询SELECT * FROM c,您将能够看到Cosmos将您的文档翻译成的格式。
https://stackoverflow.com/questions/44794180
复制相似问题