AWS documentdb documentation change
Summary
Added new documentation page for the $skip operator in Amazon DocumentDB, including description, parameters, MongoDB shell example, and code examples in Node.js and Python
Security assessment
This is a routine documentation addition for a database query operator ($skip) used for pagination. The change includes standard code examples with connection strings that contain TLS parameters (tls=true, tlsCAFile=global-bundle.pem), but these are standard secure connection practices for DocumentDB, not new security features or fixes for vulnerabilities. No evidence of addressing a specific security vulnerability or incident.
Diff
diff --git a/documentdb/latest/developerguide/skip.md b/documentdb/latest/developerguide/skip.md index 8b1378917..c722b8972 100644 --- a//documentdb/latest/developerguide/skip.md +++ b//documentdb/latest/developerguide/skip.md @@ -0,0 +1 @@ +[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#skip "Open PDF") @@ -1,0 +3,138 @@ +[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) + +Example (MongoDB Shell)Code examples + +# $skip + +In Amazon DocumentDB, the `$skip` operator is used to offset the starting point of the query results, allowing you to retrieve a specific subset of the matching documents. This is particularly useful in pagination scenarios, where you want to retrieve subsequent pages of results. + +**Parameters** + + * `skip`: The number of documents to skip before returning the remaining documents. + + + + +## Example (MongoDB Shell) + +The following example demonstrates how to use the `$skip` operator to retrieve the second page of results (documents 11-20) from a collection. + +**Create sample documents** + + + db.collection.insert([ + { "name": "Document 1" }, + { "name": "Document 2" }, + { "name": "Document 3" }, + { "name": "Document 4" }, + { "name": "Document 5" }, + { "name": "Document 6" }, + { "name": "Document 7" }, + { "name": "Document 8" }, + { "name": "Document 9" }, + { "name": "Document 10" }, + { "name": "Document 11" }, + { "name": "Document 12" }, + { "name": "Document 13" }, + { "name": "Document 14" }, + { "name": "Document 15" }, + { "name": "Document 16" }, + { "name": "Document 17" }, + { "name": "Document 18" }, + { "name": "Document 19" }, + { "name": "Document 20" } + ]); + +**Query example** + + + db.collection.find({}, { "name": 1 }) + .skip(10) + .limit(10); + +**Output** + + + [ + { "_id" : ObjectId("..."), "name" : "Document 11" }, + { "_id" : ObjectId("..."), "name" : "Document 12" }, + { "_id" : ObjectId("..."), "name" : "Document 13" }, + { "_id" : ObjectId("..."), "name" : "Document 14" }, + { "_id" : ObjectId("..."), "name" : "Document 15" }, + { "_id" : ObjectId("..."), "name" : "Document 16" }, + { "_id" : ObjectId("..."), "name" : "Document 17" }, + { "_id" : ObjectId("..."), "name" : "Document 18" }, + { "_id" : ObjectId("..."), "name" : "Document 19" }, + { "_id" : ObjectId("..."), "name" : "Document 20" } + ] + +## Code examples + +To view a code example for using the `$skip` command, choose the tab for the language that you want to use: + +Node.js + + + + const { MongoClient } = require('mongodb'); + + async function main() { + const client = await MongoClient.connect('mongodb://<username>:<password>@<cluster-endpoint>:27017/?tls=true&tlsCAFile=global-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false'); + const db = client.db('test'); + const collection = db.collection('collection'); + + const results = await collection.find({}, { projection: { name: 1 } }) + .skip(10) + .limit(10) + .toArray(); + + console.log(results); + + await client.close(); + } + + main(); + +Python + + + + from pymongo import MongoClient + + def main(): + client = MongoClient('mongodb://<username>:<password>@<cluster-endpoint>:27017/?tls=true&tlsCAFile=global-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false') + db = client.mydatabase + collection = db.collection + + results = list(collection.find({}, {'name': 1}) + .skip(10) + .limit(10)) + + print(results) + + client.close() + + if __name__ == '__main__': + main() + + **Javascript is disabled or is unavailable in your browser.** + +To use the Amazon Web Services Documentation, Javascript must be enabled. Please refer to your browser's Help pages for instructions. + +[Document Conventions](/general/latest/gr/docconventions.html) + +$setUnion + +$slice + +Did this page help you? - Yes + +Thanks for letting us know we're doing a good job! + +If you've got a moment, please tell us what we did right so we can do more of it. + +Did this page help you? - No + +Thanks for letting us know this page needs work. We're sorry we let you down. + +If you've got a moment, please tell us how we can make the documentation better.