我是 mongodb 新手,面临数据结构问题。数据的层次结构不可见。例如,我的数据格式为
{
"FCILTY_ID" : 154,
"ACCT_NO" : 2.14782e+008,
"STRING_DC_CD" : 8,
"STRING_DTS" : "25-JAN-14",
"STRING_ID_NO" : 1,
"STRING_ITEM_NO" : 0,
"CHILD_OF_CD" : "",
"BINTYPE_NO" : 244,
"PTXT_CODE_STR" : "8.1.71.4.0.0.0.13",
"PTXT_DESC_TXT" : "DC DATE =",
"VALUE_NO" : 2.37024e+007,
"VALUE_FREETEXT_TXT" : "",
"VALUE_DTS" : "25-JAN-14"
}
{
"FCILTY_ID" : 154,
"ACCT_NO" : 2.14782e+008,
"STRING_DC_CD" : 8,
"STRING_DTS" : "25-JAN-14",
"STRING_ID_NO" : 1,
"STRING_ITEM_NO" : 2,
"CHILD_OF_CD" : "",
"BINTYPE_NO" : 244,
"PTXT_CODE_STR" : "8.1.71.4.0.0.0.167",
"PTXT_DESC_TXT" : "START TIME",
"VALUE_NO" : 2.37024e+007,
"VALUE_FREETEXT_TXT" : "",
"VALUE_DTS" : "25-JAN-14"
}
{
"FCILTY_ID" : 154,
"ACCT_NO" : 2.14782e+008,
"STRING_DC_CD" : 8,
"STRING_DTS" : "25-JAN-14",
"STRING_ID_NO" : 1,
"STRING_ITEM_NO" : 3,
"CHILD_OF_CD" : "",
"BINTYPE_NO" : 241,
"PTXT_CODE_STR" : "8.1.71.4.0.0.0.153",
"PTXT_DESC_TXT" : "ORDER TYPE",
"VALUE_NO" : 0,
"VALUE_FREETEXT_TXT" : "",
"VALUE_DTS" : ""
}
我正在努力但无法使用聚合和更新使数据具有理想的结构。我想要这样的数据结构
{
"FCILTY_ID" : 154,
"ACCT_NO" : 2.14782e+008,
"STRING_DC_CD" : 8,
"STRING_DTS" : "25-JAN-14",
"STRING_ID_NO" : 1,
"ITEM":
[ {
{"STRING_ITEM_NO" : 0,
"CHILD_OF_CD" : "",
"BINTYPE_NO" : 244,
"PTXT_CODE_STR" : "8.1.71.4.0.0.0.13",
"PTXT_DESC_TXT" : "DC DATE =",
"VALUE_NO" : 2.37024e+007,
"VALUE_FREETEXT_TXT" : "",
"VALUE_DTS" : "25-JAN-14"}
{
"STRING_ITEM_NO" : 2,
"CHILD_OF_CD" : "",
"BINTYPE_NO" : 244,
"PTXT_CODE_STR" : "8.1.71.4.0.0.0.167",
"PTXT_DESC_TXT" : "START TIME",
"VALUE_NO" : 2.37024e+007,
"VALUE_FREETEXT_TXT" : "",
"VALUE_DTS" : "25-JAN-14"}
{
"STRING_ITEM_NO" : 3,
"CHILD_OF_CD" : "",
"BINTYPE_NO" : 241,
"PTXT_CODE_STR" : "8.1.71.4.0.0.0.153",
"PTXT_DESC_TXT" : "ORDER TYPE",
"VALUE_NO" : 0,
"VALUE_FREETEXT_TXT" : "",
"VALUE_DTS" : ""}
}
] }
这在mongodb中可行吗?如果没有,我可以使用任何其他工具来实现这一点。我想在 apache Drill 中插入数据,但在此之前我希望数据结构具有适当的层次结构。提前致谢!