CosmosDB $sample aggregation delivers always the same result

梦想的初衷 提交于 2020-06-28 05:30:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!