gpt4 book ai didi

database - 显示所有可能性? (是或否)

转载 作者:行者123 更新时间:2023-12-05 01:18:00 27 4
gpt4 key购买 nike

我创建此代码是为了在 MongoDB 中创建 TPC-H 架构,并进行了一些验证:

db.createCollection("lineItem", {
validator: {
$or: [
{
"lineNumber": { $type: "int"}
},
{
"quantity": { $type: "decimal"}
},
{
"extendedPrice": { $type: "decimal"}
},
{
"discount": { $type: "decimal"}
},
{
"tax": { $type: "decimal"}
},
{
"returnFlag": { $type: "string"}
},
{
"lineStatus": { $type: "string"}
},
{
"shipDate": { $type: "string"}
},
{
"commitDate": { $type: "string"}
},
{
"receiptDate": { $type: "string"}
},
{
"shipInstruct": { $type: "string"}
},
{
"shipMode": { $type: "string"}
},
{
"comment": { $type: "string"}
},
{
"order.orderKey": { $type: "int", $exists: true}
},
{
"order.orderStatus": { $type: "string"}
},
{
"order.totalPrice": { $type: "decimal"}
},
{
"order.orderDate": { $type: "string"}
},
{
"order.orderPriority": { $type: "string"}
},
{
"order.clerk": { $type: "string"}
},
{
"order.shipPriority": { $type: "int"}
},
{
"order.comment": { $type: "string"}
},
{
"order.customer.custKey": { $type: "int", $exists: true}
},
{
"order.customer.name": { $type: "string"}
},
{
"order.customer.address": { $type: "string"}
},
{
"order.customer.phone": { $type: "string"}
},
{
"order.customer.acctBal": { $type: "decimal"}
},
{
"order.customer.mktSegment": { $type: "string"}
},
{
"order.customer.comment": { $type: "string"}
},
{
"order.customer.nation.nationKey": { $type: "int", $exists: true}
},
{
"order.customer.nation.name": { $type: "string"}
},
{
"order.customer.nation.comment": { $type: "string"}
},
{
"order.customer.nation.region.regionKey": { $type: "int", $exists: true}
},
{
"order.customer.nation.region.regionName": { $type: "string"}
},
{
"order.customer.nation.region.comment": { $type: "string"}
},
{
"partSupp.availQty": { $type: "int"}
},
{
"partSupp.supplyCost": { $type: "decimal"}
},
{
"partSupp.comment": { $type: "string"}
},
{
"partSupp.part.partKey": { $type: "int", $exists: true}
},
{
"partSupp.part.name": { $type: "string"}
},
{
"partSupp.part.mfgr": { $type: "string"}
},
{
"partSupp.part.brand": { $type: "string"}
},
{
"partSupp.part.type": { $type: "string"}
},
{
"partSupp.part.size": { $type: "int"}
},
{
"partSupp.part.container": { $type: "string"}
},
{
"partSupp.part.retailPrice": { $type: "decimal"}
},
{
"partSupp.part.comment": { $type: "string"}
},
{
"partSupp.supplier.suppKey": { $type: "int", $exists: true}
},
{
"partSupp.supplier.name": { $type: "string"}
},
{
"partSupp.supplier.address": { $type: "string"}
},
{
"partSupp.supplier.phone": { $type: "string"}
},
{
"partSupp.supplier.acctBal": { $type: "decimal"}
},
{
"partSupp.supplier.comment": { $type: "string"}
},
{
"partSupp.supplier.nation.nationKey": { $type: "int", $exists: true}
},
{
"partSupp.supplier.nation.name": { $type: "string"}
},
{
"partSupp.supplier.nation.comment": { $type: "string"}
},
{
"partSupp.supplier.nation.region.regionKey": { $type: "int", $exists: true}
},
{
"partSupp.supplier.nation.region.regionName": { $type: "string"}
},
{
"partSupp.supplier.nation.region.comment": { $type: "string"}
}
]
}
})

它工作得很好(我认为),但是,我在为上面的这个集合创建插入代码时遇到了一些麻烦。这是我要插入的内容:

db.lineItem.insertOne({
"lineNumber": 1,
"quantity": 17,
"extendedPrice": 24710.35,
"discount": 0.04,
"tax": 0.02,
"returnFlag": "N",
"lineStatus": "O",
"shipDate": "1996-03-13",
"commitDate": "1996-02-12",
"receiptDate": "1996-03-22",
"shipInstruct": "DELIVER IN PERSON",
"shipMode": "TRUCK",
"comment": "egular courts above the",
"order": {
"orderKey": 1,
"orderStatus": "O",
"totalPrice": 172799.49,
"orderDate": "1996-01-02",
"orderPriority": "5-LOW",
"clerk": "Clerk#000000951",
"shipPriority": 0,
"comment": "nstructions sleep furiously among ",
"customer": {
"custKey": 370,
"name": "Customer#000000370",
"address": "oyAPndV IN",
"phone": "22-524-280-8721",
"acctBal": 8982.79,
"mktSegment": "FURNITURE",
"comment": "ges. final packages haggle quickly. slyly bold ",
"nation": {
"nationKey": 12,
"name": "JAPAN",
"comment": "ously. final",
"region": {
"regionKey": 2,
"regionName": "ASIA",
"comment": "ges. thinly even pinto beans ca"
}
}
}
},
"partSupp": {
"availQty": 7030,
"supplyCost": 802.33,
"comment": "p about the enticingly quiet pinto beans. furiously ironic packages are care",
"part": {
"partKey": 1552,
"name": "plum chartreuse sky pale firebrick",
"mfgr": "Manufacturer#4",
"brand": "Brand#41",
"type": "SMALL POLISHED TIN",
"size": 10,
"container": "WRAP CASE",
"retailPrice": 1453.55,
"comment": "onic deposits"
},
"supplier": {
"suppKey": 93,
"name": "Supplier#000000093",
"address": "wd1djjKXT4zBm",
"phone": "26-528-528-1157",
"acctBal": 368.76,
"comment": "yly final accounts could are carefully. fluffily ironic instruct",
"nation": {
"nationKey": 16,
"name": "MOZAMBIQUE",
"comment": "s. ironic",
"region": {
"regionKey": 0,
"regionName": "AFRICA",
"comment": "lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to"
}
}
}
}
});

然而,在我尝试运行它之前,MongoDB 控制台显示供应商的代码如下:

... "supplier": { 
... Display all 173 possibilities? (y or n)

当我在此集合中插入并运行 find() 时,supplier 没有 suppKey,它向我显示了一个 ane 而不是里面的name

我已经看过 this询问相同问题的问题,但是,我的那里没有提到这些空间。

我应该怎么做才能停止收到这个错误?

最佳答案

'> db.staffList.insert(... (代码已删除)
显示所有 175 种可能性? (是或否)

尝试将代码复制到 MS Word 中,然后按按钮打开隐藏的字符。

在 Excel 中创建代码后,我遇到了同样的问题。代码中到处都是标签。移除标签,它应该有更好的工作机会。

(要去除 Word 中的制表符,请将 ^t 替换为空。)

希望这对您有所帮助。

关于database - 显示所有可能性? (是或否),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47460724/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com