I was making this application using MERN stack. But what I want to know is, how are multiple images persisted in my mongoDB atlas, and how do I fetch them sequentially. I came up with an idea to store the filenames with in a field called images which is an Array. but I got stuck on fetching those sequentially, like one post can have multiple images. Any suggestions on how i should implement this feature I was using react quill as my text editor.
import { Schema } from "mongoose";
import mongoose from "mongoose";
const PostSchema = new Schema(
{
photo: {
type: String,
required: false,
},
title: {
type: String,
required: true,
},
desc: {
type: String,
required: true,
},
username: {
type: String,
required: true,
},
categories: {
type: Array,
required: false,
},
},
{ timestamps: true }
);
export default mongoose.model("Post", PostSchema);