There is a structure:

var ticketSchema = new mongoose.Schema({ title: { type : String, required : true }, domainid: { type : String, required : true }, requests: { request: { type: String } }, active: { type : Boolean, required : true } }); 

How can I make a request to be a separate object within the current one, and so that it can be created as many times as desired within the current collection object?

    1 answer 1

    Option 1.

     requests: [{ request: { type: String } }], 

    According to this scheme, requests are an array of objects with a given structure (with one request key and a string value).

    Option 2.

     requests: [String], 

    Here requests is an array of strings if you don’t need an extra key and only strings are needed.