Can anyone give me suggestion?
I need to get the users owned uploaded images but i don't have a image model, i only have a Status
model like this
const StatusSchema = new Schema({
status_images: {
type: Array,
required: true
},
status_description: {
type: String,
},
status_by: {
type: Schema.Types.ObjectId, ref: 'Account',
required: true
},
status_date: {
type: Date,
default: Date.now
}
});
As you can see there is a status_images
property , so i'm thinking on just querying the Status Schema to find and get only the status_images
instead of building another Model for the images but is this ideal?
Here's an example of saved data
{
"_id": {
"$oid": "5b0cffba349fff03c7afba16"
},
"status_images": [
"http://res.cloudinary.com/2313/image/upload/v1527578553/1.png",
"http://res.cloudinary.com/2313/image/upload/v1527578553/2.png",
"http://res.cloudinary.com/2313/image/upload/v1527578553/3.png",
"http://res.cloudinary.com/2313/image/upload/v1527578553/3.png"
],
"status_description": "get to know",
"status_by": {
"$oid": "5af16d60f3957c11e46500ae"
},
"status_date": {
"$date": "2018-04-14T07:22:34.224Z"
},
"__v": 1
}