문제

What I what is a query with offset and limit of one, that when the offset is bigger than the count it returns the first one.

For example: if I have a collecton with 3 elements and I do a query with offset = 4 I will get the first element. Any idea of how to implement this?

도움이 되었습니까?

해결책

Do a count() first and if the number is less than your offset do a findOne?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top