const itemSchema = new Schema({
name: String,
tags: [String] // Tags embedded as an array of strings
});
const Item = mongoose.model('Item', itemSchema);
// Create an item with tags embedded
async function createItem(name, tags) {
const item = new Item({ name, tags });
await item.save();
console.log('Item created with embedded tags:', item);
}
createItem('Notebook', ['school', 'writing']);
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.