Limit no. of rows in mongodb input

陌路散爱 提交于 2019-12-05 18:51:31

There are several query modification operators you can use. Their names are not totally intuitive and don't match the names of functions you would use in the Mongo shell, but they do the same sorts of things.

In your case, you need the $maxScan operator. You could write your query as:

{"$query": {...}, "$maxScan": 10}

We have to use aggregation method providing by MongoDB, and here is the link: docs.mongodb.org/manual/applications/aggregation.

In my case, I use this query in MongoDB Input of Kettle, and we also have to choose Query is aggregation pipline.

{$match: {activity_type: " view "}},
{$sort: {activity_target: -1 } },
{$limit: 10}

The following screen shots can help you understand the operations more clear.

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