Search code examples
swiftfluentvapor

How can I set the limit on a Fluent Query?


How can I set a limit and an offset on a Query using Vapor's Fluent?


Solution

  • First you have to import Fluent

    Then you'll get some compiler help to do the following:

    var query = try <##YourModelClass##>.query()
    query.limit = Limit(count: count, offset: offset)