@@ -85,6 +85,23 @@ To learn more about the shapes you can use in MongoDB, see the
85
85
86
86
.. external resource
87
87
88
+ Insert a Document Containing GeoJSON Data
89
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
90
+
91
+ To insert a document that stores GeoJSON data, create a document that contains a GeoJSON
92
+ value and pass the document to the ``insertOne()`` method.
93
+
94
+ The following example inserts a document that includes a ``location.geo`` field,
95
+ which contains GeoJSON data:
96
+
97
+ .. literalinclude:: /includes/fundamentals/code-snippets/Geo.java
98
+ :language: java
99
+ :dedent:
100
+ :start-after: begin insertGeoJSONExample
101
+ :end-before: end insertGeoJSONExample
102
+
103
+ To learn more about inserting documents, see the :ref:`java-fundamentals-insert` guide.
104
+
88
105
Index
89
106
~~~~~
90
107
@@ -118,6 +135,24 @@ Legacy coordinate pairs have the following structure:
118
135
Your field should contain an array of two values in which the first represents
119
136
the ``x`` axis value and the second represents the ``y`` axis value.
120
137
138
+ Insert a Document Containing Legacy Coordinates
139
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140
+
141
+ To insert a document that stores a legacy coordinate pair, create a document that
142
+ assigns a coordinate pair value to a field. Then, pass the document to the
143
+ ``insertOne()`` method.
144
+
145
+ The following example inserts a document that includes a ``coordinates`` field,
146
+ which contains a legacy coordinate pair:
147
+
148
+ .. literalinclude:: /includes/fundamentals/code-snippets/Geo.java
149
+ :language: java
150
+ :dedent:
151
+ :start-after: begin insertLegacyExample
152
+ :end-before: end insertLegacyExample
153
+
154
+ To learn more about inserting documents, see the :ref:`java-fundamentals-insert` guide.
155
+
121
156
Index
122
157
~~~~~
123
158
0 commit comments