AWS Security ChangesHomeSearch

AWS documentdb documentation change

Service: documentdb · 2026-03-31 · Documentation low

File: documentdb/latest/developerguide/geometry.md

Summary

Added comprehensive documentation for the $geometry operator in Amazon DocumentDB, including detailed explanation, supported GeoJSON types, parameters, MongoDB Shell examples, and code examples in Node.js and Python.

Security assessment

This change adds standard feature documentation for geospatial query functionality ($geometry operator). The code examples include TLS connection parameters (tls=true, tlsCAFile=global-bundle.pem) which are standard security practices for DocumentDB connections, but this is not new security documentation - it's just showing standard connection strings. There is no evidence this addresses a specific security vulnerability or weakness.

Diff

diff --git a/documentdb/latest/developerguide/geometry.md b/documentdb/latest/developerguide/geometry.md
index 8b1378917..32bbe7d02 100644
--- a//documentdb/latest/developerguide/geometry.md
+++ b//documentdb/latest/developerguide/geometry.md
@@ -0,0 +1 @@
+[](/pdfs/documentdb/latest/developerguide/developerguide.pdf#geometry "Open PDF")
@@ -1,0 +3,206 @@
+[Documentation](/index.html)[Amazon DocumentDB](/documentdb/index.html)[Developer Guide](what-is.html)
+
+Example (MongoDB Shell)Code examples
+
+# $geometry
+
+The `$geometry` operator in Amazon DocumentDB is used to specify a GeoJSON geometry object as part of a geospatial query. This operator is used in conjunction with other geospatial query operators like `$geoWithin` and `$geoIntersects` to perform spatial queries on your data.
+
+In Amazon DocumentDB, the `$geometry` operator supports the following GeoJSON geometry types:
+
+  * Point
+
+  * LineString
+
+  * Polygon
+
+  * MultiPoint
+
+  * MultiLineString
+
+  * MultiPolygon
+
+  * GeometryCollection
+
+
+
+
+**Parameters**
+
+  * `type`: The type of the GeoJSON geometry object, e.g., `Point`, `Polygon`, etc.
+
+  * `coordinates`: An array of coordinates representing the geometry. The structure of the coordinates array depends on the geometry type.
+
+
+
+
+## Example (MongoDB Shell)
+
+The following example demonstrates how to use the `$geometry` operator to perform a `$geoIntersects` query in Amazon DocumentDB.
+
+**Create sample documents**
+    
+    
+    db.locations.insertMany([
+      { 
+        "_id": 1,
+        "name": "Location 1",
+        "location": { 
+          "type": "Point",
+          "coordinates": [-73.983253, 40.753941]
+        }
+      },
+      { 
+        "_id": 2,
+        "name": "Location 2", 
+        "location": {
+          "type": "Polygon",
+          "coordinates": [[
+            [-73.998427, 40.730309],
+            [-73.954348, 40.730309],
+            [-73.954348, 40.780816],
+            [-73.998427, 40.780816],
+            [-73.998427, 40.730309]
+          ]]
+        }
+      }
+    ]);
+
+**Query example**
+    
+    
+    db.locations.find({
+      "location": {
+        "$geoIntersects": {
+          "$geometry": {
+            "type": "Polygon",
+            "coordinates": [[
+              [-73.998, 40.730],
+              [-73.954, 40.730],
+              [-73.954, 40.781],
+              [-73.998, 40.781],
+              [-73.998, 40.730]
+            ]]
+          }
+        }
+      }
+    })
+
+**Output**
+    
+    
+    [
+      {
+        "_id": 2,
+        "name": "Location 2",
+        "location": {
+          "type": "Polygon",
+          "coordinates": [
+            [
+              [-73.998427, 40.730309],
+              [-73.954348, 40.730309],
+              [-73.954348, 40.780816],
+              [-73.998427, 40.780816],
+              [-73.998427, 40.730309]
+            ]
+          ]
+        }
+      }
+    ]
+
+## Code examples
+
+To view a code example for using the `$geometry` 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('locations');
+    
+      const query = {
+        "location": {
+          "$geoIntersects": {
+            "$geometry": {
+              "type": "Polygon",
+              "coordinates": [[
+                [-73.998, 40.730],
+                [-73.954, 40.730],
+                [-73.954, 40.781],
+                [-73.998, 40.781],
+                [-73.998, 40.730]
+              ]]
+            }
+          }
+        }
+      };
+    
+      const result = await collection.find(query).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['locations']
+    
+        query = {
+            "location": {
+                "$geoIntersects": {
+                    "$geometry": {
+                        "type": "Polygon",
+                        "coordinates": [[
+                            [-73.998, 40.730],
+                            [-73.954, 40.730],
+                            [-73.954, 40.781],
+                            [-73.998, 40.781],
+                            [-73.998, 40.730]
+                        ]]
+                    }
+                }
+            }
+        }
+    
+        result = list(collection.find(query))
+        print(result)
+    
+        client.close()
+    
+    example()
+
+![Warning](https://d1ge0kk1l5kms0.cloudfront.net/images/G/01/webservices/console/warning.png) **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)
+
+Geospatial
+