→ Lesson 3: Catalog Options
D
Catalog of in-game items with various attributes
→ Lesson 3: Schema and Validator
{
"_id": "sword_dawn",
"type": "weapon",
"name": "Blade of Dawn",
"damage": 45,
"slots": ["main_hand"]
},
{
"_id": "potion_heal_s",
"type": "potion",
"name": "Minor Healing",
"heal": 120,
"stackable": true
}
use game_db;
db.items.insertOne({ _id: "sword_dawn", type: "weapon", name: "Blade of Dawn", damage: 45, slots: ["main_hand"] });
db.items.insertOne({ _id: "potion_heal_s", type: "potion", name: "Minor Healing", heal: 120, stackable: true });
db.items.find({ _id: "sword_dawn" });
Each item type has its own set of attributes, which changes every sprint—the document naturally reflects this. This is an example of a model, not a solution for the project: a comparison with jsonb will be covered in Lesson 3.