问题
i'm a newbie in Mongo and Cosmos DB. I'm trying to get some random values from one collection with the following aggregation query, but it delivers repeatedly same result:
db.jokes.aggregate(
[ { $sample: { size: 1 } } ]
)
Operation consumed 2.39 RUs
{
"_id" : ObjectId("5b1526501e39b24ccc50d369"),
"joke" : "Giraffes are born or created when Chuck Norris uppercuts a Horse!",
"language" : "en"
}
db.jokes.aggregate(
[ { $sample: { size: 1 } } ]
)
Operation consumed 2.39 RUs
{
"_id" : ObjectId("5b1526501e39b24ccc50d369"),
"joke" : "Giraffes are born or created when Chuck Norris uppercuts a Horse!",
"language" : "en"
}
Am i doing something wrong or it is a bug in an aggregation feature of CosmosDB?
Many thanks and regards,
Gena
来源:https://stackoverflow.com/questions/50931887/cosmosdb-sample-aggregation-delivers-always-the-same-result