Limit is not applied (Nextjs)

I am new to Builder.io, I am trying to get the data model, but I am getting only one instance of the model. It seems I am missing something here!

export async function getStaticProps({ params }) {
const data= await builder
    .get("model-test", {
      limit: 12,
    })
    .promise()
    .then((res) => res);
 console.log(data)
  return {
    props: {
      data,
    },
  };
}

Hi @ali-builder, Welcome to Builder.io Forum!

builder.get('model-test') will only ever return 1 element, whatever the top-ranked result is given your targeting options.

If you want multiple elements, then you can use builder.getAll('model-test', { limit: 12 } ))

Give it a try and let us know if you’ve further questions!

1 Like