Next, we are going to update our message model. We are going to save the labels, safe search result, and Cloudinary upload details, as well in the message. These values will be populated only for an image upload and not a text upload. Update servermodelsmessage.ts as follows:
// SNIPP SNIPP
import * as mongoose from 'mongoose';
const Schema = mongoose.Schema;
const messageSchema = new Schema({
// SNIPP SNIPP
labels: [{
type: Schema.Types.Mixed,
default: []
}],
cloudinaryProps: {
type: Schema.Types.Mixed
},
safeSearchProps: {
type: Schema.Types.Mixed
}
});
const Message = mongoose.model('Message', messageSchema);
export default Message;
// SNIPP SNIPP