Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Schema for a haikus

Status
Not open for further replies.

James Mcgill

Programmer
Jul 13, 2020
1
US
I understand how to build a schema, but I not sure how to build one for a project I am working on now. I need to build a schema for haikus, I am not sure the best way to build it but I came up with this design, what is throwing me off is the fact that the 5-7-5-syllables. How do i account for the syllables?
JavaScript:
const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const PoemsSchema = new Schema({
	user: {
		type: Schema.Types.ObjectId,
		ref: 'users'
	},
	title: {
		type: String,
		require: true
	},
	poem: [
		{
			lineOne: {
				type: String,
				require: true
			},
			lineTwo: {
				type: String,
				require: true
			},
			lineThree: {
				type: String,
				require: true
			}
		}
	],
	likes: [
		{
			user: {
				type: Schema.Types.ObjectId,
				ref: 'users'
			}
		}
	]
});

module.exports = mongoose.model('poems', PoemsSchema);
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top