I have document with this structure . I need to change the Number 3 ,Pending –> Done
is there an possible ways of doing that?
db.Queue.find({"dr-name":"1guna"},{ "queue.0":1 })
doesn’t return any thing
{ _id: ObjectId('6623b76f360aa86eb3560898'), queue: [ [], [], [], [], [] ] }
[{
"_id": {
"$oid": "6623b76f360aa86eb3560898"
},
"dr-name": "1guna",
"live-number": "0",
"est-number": "17",
"queue": [
[
"1",
"Banduka_Chamaras",
"07:16:43",
"pending",
"1711111919"
],
[
"2",
"chicken_Chamaras",
"07:17:57",
"pending",
"0711111116"
],
[
"3",
"butter_Chamaras",
"07:29:11",
"pending",
"0711111516"
],
[
"4",
"kaslisda_sds",
"06:33:47",
"pending",
"5433454534"
],
[
"5",
"kaslisda_sds",
"07:13:42",
"pending",
"5433454539"
]
]
}]
2
Answers
use pymongo
sample code for updating elements:
UPDATE:
Update an element with mongodb:
The index of an array key is determined by the query on it. Therefore the array key must be included in the query. Please see the below examples.