所以我的数据结构如下。
{
"_id" : ObjectId("5c9abc6114fa7b8226f5a847"),
"name" : "Location"
}
{
"_id" : ObjectId("5c9b9fc08bfe480004a6af0e"),
"name" : "Department"
}
收藏集:group
group
收藏。每个groupType
指向一个 {
"_id" : ObjectId("5c9abceb14fa7b8226f5a848"),
"name" : "Toronto",
"type" : {
"$ref" : "groupType",
"$id" : ObjectId("5c9abc6114fa7b8226f5a847")
}
{
"_id" : ObjectId("5c9abceb14fa7b8226f5a848"),
"name" : "Engineering",
"type" : {
"$ref" : "groupType",
"$id" : ObjectId("5c9b9fc08bfe480004a6af0e")
}
:employee
{
"_id": ObjectId("5c9abceb14fa7b8226f5a848"),
"name": "John Doe",
"groups": [{
"$ref": "group",
"$id": ObjectId("5ca3a007ff6ea900043d9c1e")
},
{
"$ref": "group",
"$id": ObjectId("5c9abceb14fa7b8226f5a848")
}
]}
收藏。每个员工都有一个组列表。我们可以假设每个雇员最多每种类型有1组。 Location
在这种情况下,该雇员是Department
类型的一组(多伦多)和view
类型的一组(工程)的成员。
我需要创建一个mongodb {
"_id" : ObjectId("5c9abceb14fa7b8226f5a848"),
"name" : "John Doe",
"location": "Toronto",
"department": "Engineering"
}
,它将以以下方式表示此员工数据:
employee
基本上,我想为每个组的groupType.name
对象添加一个密钥,如下所示:
group.name
:ORA-32361: cannot ENABLE ON QUERY COMPUTATION for the materialized view
-- create table
drop table cdt
/
create table cdt
(
id number primary key,
name varchar2(10)
)
/
create materialized view log on cdt
with
rowid,
primary key
including new values
/
create materialized view cdt_mv1
refresh fast on demand
enable query rewrite
enable on query computation
as
select
id, name
from
cdt
/
-- drop materialized view cdt_mv1;
-- drop materialized view log on cdt;
这有可能吗?我们可以假设组类型名称是唯一的。
谢谢!