[{
"_id": {
"$oid": "5ee227d69dba6729ca8938fc"
},
"uuid": "4e9be217-a2c7-490f-86b7-2d46a69980a3",
"locks": {
"furnace_1591879638": {
"type": "FURNACE",
"location": {
"world": "world",
"x": -33,
"y": 73,
"z": -227
},
"created": "Thu Jun 11 14:47:18 CEST 2020",
"peopleWithAccess": []
},
"chest_1591903237541": {
"type": "CHEST",
"location": {
"world": "world",
"x": -36,
"y": 73,
"z": -224
},
"created": "Thu Jun 11 21:20:37 CEST 2020",
"peopleWithAccess": []
}
}
},{
"_id": {
"$oid": "5ee2864622c67536a249fb0a"
},
"uuid": "6fc93f76-b03b-4af3-a679-ac53cafdb288",
"locks": {}
}]
Hi, I just stared with MongoDB and I was used to working with MySQL so this is really confusing for me. I've been trying to delete a object from an array but unsuccessfully. I tried this:
getMongoManager().getDatabase().getCollection("players").updateOne(new Document("uuid", player.getUniqueId().toString()),
new Document("$unset", "locks." + id))
That gave me an error Modifiers operate on fields but we found type string instead. How would I delete for exmaple object furnace_1591879638 from player with uuid 4e9be217-a2c7-490f-86b7-2d46a69980a3 in Java?