From c0d7b1fed9aa9b98be4106f3a81b81f87cb18d25 Mon Sep 17 00:00:00 2001 From: Betsy Gitelman Date: Wed, 18 Dec 2024 13:47:48 -0500 Subject: [PATCH] Edits to Added documentation for sub-JSON accessing feature in Mongo FDW Key Features #6350 --- .../5/06_features_of_mongo_fdw.mdx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/product_docs/docs/mongo_data_adapter/5/06_features_of_mongo_fdw.mdx b/product_docs/docs/mongo_data_adapter/5/06_features_of_mongo_fdw.mdx index 3b3b39cd336..5470c31cdd9 100644 --- a/product_docs/docs/mongo_data_adapter/5/06_features_of_mongo_fdw.mdx +++ b/product_docs/docs/mongo_data_adapter/5/06_features_of_mongo_fdw.mdx @@ -8,7 +8,7 @@ These are the key features of the MongoDB Foreign Data Wrapper. ## Writable FDW -The MongoDB Foreign Data Wrapper lets you modify data on a MongoDB server. You can insert, update, and delete data in the remote MongoDB collections by inserting, updating and deleting data locally in foreign tables. +The MongoDB Foreign Data Wrapper lets you modify data on a MongoDB server. You can insert, update, and delete data in the remote MongoDB collections by inserting, updating, and deleting data locally in foreign tables. For more information, see: @@ -72,7 +72,7 @@ You can retrieve all available fields in a collection residing in MongoDB Foreig { "_id" : ObjectId("58a1ebbaf543ec0b9054585a"), "warehouse_id" : 2, "warehouse_name" : "Laptop", "warehouse_created" : ISODate("2015-11-11T08:13:10Z") } ``` -Steps for retrieving the document: +To retrieve the document: 1. Create a foreign table with a column name `__doc`. The type of the column can be json, jsonb, text, or varchar. @@ -86,7 +86,7 @@ Steps for retrieving the document: SELECT * FROM test_json ORDER BY __doc::text COLLATE "C"; ``` - The output: + The following is the output: ```sql edb=#SELECT * FROM test_json ORDER BY __doc::text COLLATE "C"; @@ -99,9 +99,9 @@ Steps for retrieving the document: ## Accessing nested fields -MongoDB Foreign Data Wrapper allows you to access individual fields within nested JSON documents by mapping the nested structure to columns in a foreign table. +MongoDB Foreign Data Wrapper allows you to access individual fields in nested JSON documents by mapping the nested structure to columns in a foreign table. This works by mapping the nested structure of the MongoDB document to relational columns in the foreign table definition, using dot notation (key2.subkey21) to reference nested fields. -You can retrieve these fields from a collection as shown in the following example: +You can retrieve these fields from a collection as shown in the following example. ### Example @@ -120,9 +120,9 @@ db1> db.test_sub_json.find() ] ``` -Steps for retrieving sub-fields from the document: +To retrieve subfields from the document: -1. Create a foreign table. To access a sub-field use the dot (".") in the column name as shown below: +1. Create a foreign table. To access a subfield, use the dot (".") in the column name: ```sql CREATE FOREIGN TABLE ft_nested_json_test( @@ -135,7 +135,7 @@ Steps for retrieving sub-fields from the document: OPTIONS (database 'db1', collection 'test_sub_json'); ``` -1. Retrieve the document with sub-fields: +1. Retrieve the document with subfields: ```sql SELECT * FROM ft_nested_json_test;