How can i limit for returning the result using this query

let products = Restaurant.Collection.Products.find({
      categoryId: categoryId,
      $text: {
        $search: tags.join(' ')
      }
    }, {
      fields: {
        score: {
          $meta: 'textScore'
        }
      },
      sort: {
        score: {
          $meta: 'textScore'
        }
      }
    });
let products = Restaurant.Collection.Products.find({
    categoryId: categoryId,
    $text: {
        $search: tags.join(' ')
    }
}, {
    fields: {
        score: {
            $meta: 'textScore'
        }
    },
    sort: {
        score: {
            $meta: 'textScore'
        }
    },
    limit: 10
});
2 Likes

thanks i’ve got it to work :slight_smile:

1 Like