AWS documentdb documentation change
Summary
Entire documentation page for the $limit operator in Amazon DocumentDB has been removed, including all content, examples, and code samples.
Security assessment
The change removes documentation content entirely without any mention of security vulnerabilities, weaknesses, or incidents. This appears to be a documentation restructuring or removal of a page, not a security-related update. There is no evidence in the diff of addressing security issues or adding security features.
Diff
diff --git a/documentdb/latest/developerguide/limit.md b/documentdb/latest/developerguide/limit.md index 2e1bf06e7..8b1378917 100644 --- a//documentdb/latest/developerguide/limit.md +++ b//documentdb/latest/developerguide/limit.md @@ -1 +0,0 @@ -[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#limit "Open PDF") @@ -3,147 +1,0 @@ -[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) - -Example (MongoDB Shell)Code examples - -# $limit - -The `$limit` operator in Amazon DocumentDB is used to restrict the number of documents returned by a query. It is similar to the MongoDB `$limit` operator, but there are some specific considerations when using it with Amazon DocumentDB. - -In Amazon DocumentDB, the `$limit` operator is useful for pagination, where you want to retrieve a subset of the total matching documents. It allows you to control the number of documents returned in each response, improving performance and reducing the amount of data transferred over the network. - -**Parameters** - - * `limit`: The maximum number of documents to return. This must be a non-negative integer value. - - - - -## Example (MongoDB Shell) - -The following example demonstrates how to use the `$limit` operator to return a maximum of one document that matches the given filter. - -**Create sample documents** - - - db.test.insertMany([ - { "_id": 1, "star_rating": 4, "comments": "apple is red" }, - { "_id": 2, "star_rating": 5, "comments": "comfortable couch" }, - { "_id": 3, "star_rating": 3, "comments": "apples, oranges - healthy fruit" }, - { "_id": 4, "star_rating": 5, "comments": "this is a great couch" }, - { "_id": 5, "star_rating": 5, "comments": "interesting couch" } - ]); - -**Query example** - - - db.test.createIndex({ comments: "text" }); - - db.test.find({ - $and: [ - { star_rating: 5 }, - { $text: { $search: "couch" } } - ] - }).limit(1); - -**Output** - - - [ { _id: 2, star_rating: 5, comments: 'comfortable couch' } ] - -## Code examples - -To view a code example for using the `$limit` command, choose the tab for the language that you want to use: - -Node.js - - - - const { MongoClient } = require('mongodb'); - - async function limitExample() { - const client = await MongoClient.connect('mongodb://<username>:<password>@<cluster-endpoint>:27017/?tls=true&tlsCAFile=global-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false'); - - try { - await client.connect(); - - const db = client.db('test'); - const collection = db.collection('test'); - - await collection.createIndex({ comments: 'text' }); - - const query = { - $and: [ - { star_rating: 5 }, - { $text: { $search: "couch" } } - ] - }; - - const result = await collection.find(query).limit(1).toArray(); - - console.log(result); - - } catch (err) { - console.error("Error:", err); - } finally { - await client.close(); - } - - } - - limitExample(); - -Python - - - - from pymongo import MongoClient - - def limit_example(): - try: - client = MongoClient('mongodb://<username>:<password>@<cluster-endpoint>:27017/?tls=true&tlsCAFile=global-bundle.pem&replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false') - - db = client['test'] - collection = db['test'] - - collection.create_index([('comments', 'text')]) - - query = { - '$and': [ - {'star_rating': 5}, - {'$text': {'$search': 'couch'}} - ] - } - - result = collection.find(query).limit(1) - - for doc in result: - print(doc) - - except Exception as e: - print(f"An error occurred: {e}") - - finally: - client.close() - - limit_example() - - **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) - -$let - -$literal - -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.