It seems that your question is clearly asked "get every nth instance", which seems like a pretty clear question.
Query operations such as .find() can actually return the document “as is,” with the exception of the general “highlight” field in the projection, and operators such as the positional $ match or $elemMatch that allow a single matched array element.
Of course, there is $slice , but it only allows "range selection" in the array, so it does not apply again.
The "only" things that can change the result on the server are .aggregate() and .mapReduce() . The first one doesn't play very well with slicing arrays, at least with the help of "n" elements. However, since the "function ()" arguments of mapReduce are based on JavaScript logic, you have a bit more room to play.
For analytical processes and for analytical purposes only, then simply filter the contents of the array using mapReduce using .filter() :
db.collection.mapReduce( function() { var id = this._id; delete this._id;
This is actually just a "JavaScript Runner", but if it's just for analysis / analysis, then there is nothing wrong with this concept. Of course, the output is not "exactly" how your document is structured, but it is as close to a facsimile as mapReduce can get.
Another suggestion that I see here requires creating a new collection with all the "denormalized" elements and inserting an "index" from the array as part of the unique _id _id. This can lead to the fact that you can request directly, for example, "every n-th element", which you still have to do:
db.resultCollection.find({ "_id.index": { "$in": [2,5,8,11,14] }
So practice and specify the index value of "every n-th element" to get "every n-th element". So it doesn't seem to solve the problem that was asked.
If the output form seems more desirable for your "testing" purposes, then the best subsequent request for these results would be to use the aggregation pipeline with $redact
db.newCollection([ { "$redact": { "$cond": { "if": { "$eq": [ { "$mod": [ { "$add": [ "$_id.index", 1] }, 3 ] }, 0 ] }, "then": "$$KEEP", "else": "$$PRUNE" } }} ])
This at least uses a “logical condition”, almost the same as that used with .filter() before, just to select the elements of the nth index without listing all possible index values as a query argument.