AWS documentdb documentation change
Summary
Entire documentation page for the $rand operator was removed, including all examples, code samples, and explanatory content
Security assessment
This change removes general documentation about the $rand operator functionality in Amazon DocumentDB. There is no evidence in the diff of security vulnerabilities, security fixes, or security-related content being added. The removed content appears to be standard operational documentation without security implications.
Diff
diff --git a/documentdb/latest/developerguide/rand.md b/documentdb/latest/developerguide/rand.md index 84caa8598..8b1378917 100644 --- a//documentdb/latest/developerguide/rand.md +++ b//documentdb/latest/developerguide/rand.md @@ -1 +0,0 @@ -[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#rand "Open PDF") @@ -3,127 +1,0 @@ -[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html) - -Example (MongoDB Shell)Code examples - -# $rand - -New from version 8.0 - -The `$rand` operator in Amazon DocumentDB is used to generate a random number between 0 and 1. - -**Parameters** - -None - -## Example (MongoDB Shell) - -The following example demonstrates how to use the `$rand` operator to randomly select two documents from the `temp` collection. - -**Create sample documents** - - - db.items.insertMany([ - { "name": "pencil", "quantity": 110 }, - { "name": "pen", "quantity": 159 } - ]) - -**Query example** - - - db.items.aggregate([ - { - $project: { - randomValue: { $rand: {} } - } - } - ]) - -**Output** - - - [ - { - _id: ObjectId('6924a5edd66dcae121d29517'), - randomValue: 0.8615243955294392 - }, - { - _id: ObjectId('6924a5edd66dcae121d29518'), - randomValue: 0.22815483022099903 - } - ] - -## Code examples - -To view a code example for using the `$rand` command, choose the tab for the language that you want to use: - -Node.js - - - - const { MongoClient } = require('mongodb'); - - async function example() { - 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('items'); - - const result = await collection.aggregate([ - { - $project: { - randomValue: { $rand: {} } - } - } - ]).toArray(); - - console.log(result); - - await client.close(); - } - - example(); - -Python - - - - from pymongo import MongoClient - - def example(): - 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['items'] - - result = list(collection.aggregate([ - { - "$project": { - "randomValue": { "$rand": {} } - } - } - ])) - - print(result) - - client.close() - - 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) - -$project - -$range - -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.