I have a collection of books, which basically stores the info of books and a ref of their author.
const bookSchema = new Schema<IBook>({
name: {
type: String,
},
author: {
type: Schema.Types.ObjectId,
ref: 'user',
required: true,
},
});
Now I want to paginate this collection having a huge number of books but I want only or at max two books from the same author on a single page, just to keep the feed more interesting and unique.