Answer the question
In order to leave comments, you need to log in
How to disable showing __v in mongodb?
How can I disable showing versionKey and still cut the first image, i.e. to meet two conditions?
const conditions = {}
const projection = {
images: { $slice: 1 },
versionKey: false
}
Answer the question
In order to leave comments, you need to log in
const MaxLimitImages = 1000; // Укажите максимальное количество возвращаемых изображений
const conditions = {
images: { $slice: [1, MaxLimitImages] }
}
ModelName.find(conditions).select('-__v').exec( function(err, doc){
if (err) {
// Error
console.log (err)
} else {
// Ok
console.log (doc)
}
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question