sorted <- m$find(sort = '{"forks_count": -1}',
limit = 10)
How do I select only 3 features such as name, age, and income after applying the sort on the forks_count?
sorted <- m$find(sort = '{"forks_count": -1}',
limit = 10)
How do I select only 3 features such as name, age, and income after applying the sort on the forks_count?
Copyright © 2021 Jogjafile Inc.
In standard MongoDB nomenclature, this is referred to as projection. General information about that is found on this page in their documentation.
Taking a look at the Mongolite User Manual, it seems like that project uses the
fieldsparameter to provide this functionality. Based on that documentation, it looks like you can change your query to something similar to the following to get the results that you want:Note that depending on exactly what format you want your results in, you may also want to suppress the
_idvalue (eg make itfalse).