私は配列内のただ1つの整数の値を変更する方法を探しています。 配列全体を取得したくない場合は、別のスレッドが整数の値を変更できるため、値を変更して元に戻してください。Java MongoDbは配列の値を変更します
[
{
"row 1": [
0,
0,
0,
0,
0
],
"row 2": [
0,
0,
0,
0,
0
],
"row 3": [
0,
0,
0,
0,
0
],
"row 4": [
0,
0,
0,
0,
0
],
"row 5": [
0,
0,
0,
0,
0
],
"row 6": [
0,
0,
0,
0,
0
],
"row 7": [
0,
0,
0,
0,
0
],
"row 8": [
0,
0,
0,
0,
0
]
}
]
これは「showInstance」文書の中にある「席」文書で、「showInstance」文書は「ショー」ドキュメント内にあります。
これは、要素の位置を知っている場合、あなたは、例えば、値を更新するためにそれを使用することができますショー文書
{
"_id": 1,
"name": "Great rock show",
"description": "The party will roll all night long during the North American WorldWired tour as we’re psyched to announce that award-winning DJ and producer Mix Master Mike will be spinning some of your favorite (and ours!) hard rock and metal tracks throughout the evening at all of the stadium dates this summer. A pioneer in the hip-hop and DJ communities, you’ll be able to catch his skillful, hard-hitting scratch work once the doors open each night and between acts before we hit the stage.",
"band_id": 3,
"instances": [
{
"_id": {
"$oid": "58cea4779f3489310471b7db"
},
"date": {
"$date": "2017-04-07T15:00:00.000Z"
},
"price": 140,
"theater_id": 3,
"seats": [
{
"row 1": [
0,
0,
0,
0,
0
],
"row 2": [
0,
0,
0,
0,
0
],
"row 3": [
0,
0,
0,
0,
0
],
"row 4": [
0,
0,
0,
0,
0
],
"row 5": [
0,
0,
0,
0,
0
],
"row 6": [
0,
0,
0,
0,
0
],
"row 7": [
0,
0,
0,
0,
0
],
"row 8": [
0,
0,
0,
0,
0
]
}
]
},
{
"_id": {
"$oid": "58cea4779f3489310471b7dc"
},
"date": {
"$date": "2017-05-04T15:00:00.000Z"
},
"price": 758,
"theater_id": 5,
"seats": [
{
"row 1": [
0,
0,
0,
0,
0,
0
],
"row 2": [
0,
0,
0,
0,
0,
0
],
"row 3": [
0,
0,
0,
0,
0,
0
],
"row 4": [
0,
0,
0,
0,
0,
0
],
"row 5": [
0,
0,
0,
0,
0,
0
],
"row 6": [
0,
0,
0,
0,
0,
0
],
"row 7": [
0,
0,
0,
0,
0,
0
],
"row 8": [
0,
0,
0,
0,
0,
0
],
"row 9": [
0,
0,
0,
0,
0,
0
],
"row 10": [
0,
0,
0,
0,
0,
0
]
}
]
},
{
"_id": {
"$oid": "58cea4779f3489310471b7dd"
},
"date": {
"$date": "2017-05-23T15:00:00.000Z"
},
"price": 634,
"theater_id": 9,
"seats": [
{
"row 1": [
0,
0,
0,
0,
0
],
"row 2": [
0,
0,
0,
0,
0
],
"row 3": [
0,
0,
0,
0,
0
],
"row 4": [
0,
0,
0,
0,
0
]
}
]
},
{
"_id": {
"$oid": "58cea4779f3489310471b7de"
},
"date": {
"$date": "2017-06-02T15:00:00.000Z"
},
"price": 398,
"theater_id": 3,
"seats": [
{
"row 1": [
0,
0,
0,
0,
0
],
"row 2": [
0,
0,
0,
0,
0
],
"row 3": [
0,
0,
0,
0,
0
],
"row 4": [
0,
0,
0,
0,
0
],
"row 5": [
0,
0,
0,
0,
0
],
"row 6": [
0,
0,
0,
0,
0
],
"row 7": [
0,
0,
0,
0,
0
],
"row 8": [
0,
0,
0,
0,
0
]
}
]
},
{
"_id": {
"$oid": "58cea4779f3489310471b7df"
},
"date": {
"$date": "2017-06-29T15:00:00.000Z"
},
"price": 36,
"theater_id": 9,
"seats": [
{
"row 1": [
0,
0,
0,
0,
0
],
"row 2": [
0,
0,
0,
0,
0
],
"row 3": [
0,
0,
0,
0,
0
],
"row 4": [
0,
0,
0,
0,
0
]
}
]
},
{
"_id": {
"$oid": "58cea4779f3489310471b7e0"
},
"date": {
"$date": "2017-08-08T15:00:00.000Z"
},
"price": 377,
"theater_id": 11,
"seats": [
{
"row 1": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"row 2": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"row 3": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"row 4": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"row 5": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"row 6": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"row 7": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"row 8": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"row 9": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
],
"row 10": [
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
]
}
]
},
{
"_id": {
"$oid": "58cea4779f3489310471b7e1"
},
"date": {
"$date": "2017-08-28T15:00:00.000Z"
},
"price": 885,
"theater_id": 12,
"seats": [
{
"row 1": [
0,
0,
0,
0,
0,
0,
0
],
"row 2": [
0,
0,
0,
0,
0,
0,
0
],
"row 3": [
0,
0,
0,
0,
0,
0,
0
],
"row 4": [
0,
0,
0,
0,
0,
0,
0
],
"row 5": [
0,
0,
0,
0,
0,
0,
0
],
"row 6": [
0,
0,
0,
0,
0,
0,
0
],
"row 7": [
0,
0,
0,
0,
0,
0,
0
],
"row 8": [
0,
0,
0,
0,
0,
0,
0
],
"row 9": [
0,
0,
0,
0,
0,
0,
0
],
"row 10": [
0,
0,
0,
0,
0,
0,
0
],
"row 11": [
0,
0,
0,
0,
0,
0,
0
],
"row 12": [
0,
0,
0,
0,
0,
0,
0
]
}
]
},
{
"_id": {
"$oid": "58cea4779f3489310471b7e2"
},
"date": {
"$date": "2017-09-26T15:00:00.000Z"
},
"price": 853,
"theater_id": 3,
"seats": [
{
"row 1": [
0,
0,
0,
0,
0
],
"row 2": [
0,
0,
0,
0,
0
],
"row 3": [
0,
0,
0,
0,
0
],
"row 4": [
0,
0,
0,
0,
0
],
"row 5": [
0,
0,
0,
0,
0
],
"row 6": [
0,
0,
0,
0,
0
],
"row 7": [
0,
0,
0,
0,
0
],
"row 8": [
0,
0,
0,
0,
0
]
}
]
}
],
}
}
}
'seat '配列の' row'配列要素全体を更新していますか? – Veeram
いいえ、行の中の1つの要素を更新するだけです – Yuval
'' seat'配列を特定した後に更新する ''行 'とその' '行の要素を決定する基準は何ですか? – Veeram