I am confused about different TypeORM methods with similar purposes. From TypeORM docs:
.take()
— pagination limit. Sets maximal number of entities to take..skip()
— pagination offset. Sets number of entities to skip.
I poorly understand what "pagination limit/offset" means. But, unfortunately, I couldn't find any information about distinguishing of, for instance, .take()
and .limit()
. I decided to see descriptions of these methods in TypeORM's source code:
.limit()
— Set's LIMIT - maximum number of rows to be selected. NOTE that it may not work as you expect if you are using joins. If you want to implement pagination, and you are having join in your query, then use instead take method instead..offset()
— Set's OFFSET - selection offset. NOTE that it may not work as you expect if you are using joins. If you want to implement pagination, and you are having join in your query, then use instead skip method instead.
Why these two methods cannot be used for pagination? What are their purposes then? Please, could anyone provide me with clear examples of using all these 4 methods? Thanks in advance.
.limit()
may possibly cause unexpected behavior? If I wish to 'limit' 3 entities A joining B, it may take 1 entity A and 3 entities B, right? But why? – Meat