I'm using azure cosmos DB acting as MongoDB version 4.0.0. I need to get N random documents from Azure Cosmos DB using the MongoDB API. I've tried using the $sample operator but it is giving me documents in the same order each time I query.
db.collectionName.aggregate([{$sample: {size: 1}}])
No matter how many times I run this query I'm getting the same document from the collection.