I am not understanding the concept difference between collection and repository in magento2 and which is better to use.
your help will be able to appreciate.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communitySort answer : They are the same.
Long answer : Repositories are in fact more abstract than collection. The same way as collection are more abstract than ResourceModel.
Collection used to be the magento 1 way. But they are still very used in magento 2, although we should all be using Repositories.
But at the end of the day, what you need to remind is that repositories are just an abstraction of collection, so when you call repository they will end up using collection at some point.
Repositories tend to be closer from the object side. When Collection tends to be closer from the sql / database side.