I have a filter like this
var filter = Builders<Post>.Filter.Eq(x => x.IsPublic, true);
int skip = 0; int limit = 1000;
var sort = Builders<Post>.Sort.Descending(x => x.Date);
var posts = await postsRepository.QueryAsync(filter, skip, limit, sort);
Is it possible to use expand filter or sort in order to retrieve random posts?
CodePudding user response:
Use $sample to retrieve random documents.