Limit number. lines in input mongodb

How to limit the number. strings obtained in converting mongodb input used in a teapot.

I tried to execute the mongodb input request using below requests, but none of them work:

{"$ query": {"$ limit": 10}} or {"$ limit": 10}

Please let me know where I am going wrong.

Thanks Deepthi

+4
source share
2 answers

There are several modifier statement queries that you can use. Their names are not completely intuitive and do not correspond to the names of the functions that you would use in the Mongo shell, but they do the same.

In your case, you need the $maxScan operator. You can write your request as:

 {"$query": {...}, "$maxScan": 10} 
+4
source

We should use the aggregation method provided 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 need to select Query - this is pipline aggregation.

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

The following screen shots will help you understand operations more clearly.

enter image description hereenter image description here

0
source

Source: https://habr.com/ru/post/1487849/


All Articles