node.js – MongoDB secondary indexes and fast queries

I’m creating a blog website for myself.
The following is a schema for posts, I want to create fast queries on the likesCount that each post has, and on the createdAt timeStamp.
Additionally, I added a controller function that gets the most popular posts.

I have the following questions:

  1. For MongoDB, is this how we create secondary indexes with mongoose?
  2. Is the controller function scaleable?
  3. Does the logic make sense, i.e. I get the most liked post first, then the newest?

Thanks

const PostSchema = mongoose.Schema(
  {
    title: {
      type: String,
      required: true,
      minLength: (3, 'minLength of title is 3'),
      maxLength: (30, 'minLength of title is 30'),
    },
    text: {
      type: String,
      required: true,
      maxLength: (500, 'max of text is 500'),
    },
    author: {
      type: String,
      required: true,
    },
    likesCount: {
      type: Number,
      default: 0,
      index: true 
    },
    userIdArray: {
      type: (String),
      default: (),
    },
  },

  { timestamps: true }
);

PostSchema.index({"createdAt": -1});

export default mongoose.model('Post', PostSchema);
export const getTrendingPosts = asyncHandler(async (req, res) => {
  let { page, limit } = req.query;
  page = parseInt(page) || 0;
  limit = parseInt(limit) || maxLimit;
  limit = Math.min(limit, maxLimit);

  let posts = await Post.find({})
    .sort({ likesCount: -1, createdAt: -1 })
    .limit(limit)
    .skip(limit * page);
  if (posts) {
    res.send({ posts, success: true });
  } else {
    res.status(500);
    throw new Error('Trending posts were not fetched');
  }
});
```