{
"_id": "58fa4b4fa377ac2840cd1478",
"password": "pass",
"username": "test",
"__v": 45,
"stats": {
"three": [
{
"_id": "58fceef81e862e16f0501c1c",
"time": 115,
"scramble": "L2 R' U' L2 F2 B R' U' B2 L F' B' D B' F' D U B",
"status": 0,
"date": "2017-04-23T18:14:16.412Z"
},
{
"_id": "58fceefd1e862e16f0501c1d",
"time": 135,
"scramble": "D F L2 U2 R2 B2 F2 R B D' R' F' B L U2 F' U2 F U' F",
"status": 0,
"date": "2017-04-23T18:14:21.434Z"
},
{
"_id": "58fcef031e862e16f0501c1e",
"time": 101,
"scramble": "R' F R B R' L2 B' U2 D R2 F L U R2 B2 D' F U R' D",
"status": 0,
"date": "2017-04-23T18:14:27.572Z"
},
{
"_id": "58fdc8311e862e16f0501c1f",
"time": 87,
"scramble": "L2 F B' F D' B2 L2 U B2 D U2 L B' F2 B2 F2 D' R",
"status": 0,
"date": "2017-04-24T09:41:05.334Z"
}
]
},
"accountDate": "2017-04-21T18:11:27.946Z"
};
I have a model called "Users". This JSON is one of the user. Ok so the objects in "three" are their own model called "Time". I want to select one of them by their id and then update it. How will I be able to do that? I am using mongoose. Obviously Time.findOne() doesnt work because the collection is of "Users" which contain "Time".
via mrf1freak
No comments:
Post a Comment