diff --git a/mongo/pipeline1.py b/mongo/pipeline1.py new file mode 100644 index 0000000..3aa6047 --- /dev/null +++ b/mongo/pipeline1.py @@ -0,0 +1,45 @@ +pipeline = [ + { + '$addFields': { + 'location': { + 'type': 'Point', + 'coordinates': [ + { + '$toDouble': '$latdec' + }, { + '$toDouble': '$londec' + } + ] + } + } + }, { + '$match': { + 'location': { + '$geoWithin': { + '$centerSphere': [ + [ + 35.9, -78.9 + ], 100 / 3963.2 + ] + } + } + } + }, { + '$project': { + '_id': 1, + 'recrd': 1, + 'vesslterms': 1, + 'feature_type': 1, + 'chart': 1, + 'latdec': 1, + 'londec': 1, + 'gp_quality': 1, + 'depth': 1, + 'sounding_type': 1, + 'history': 1, + 'quasou': 1, + 'watlev': 1, + 'coordinates': 1 + } + } +] diff --git a/mongo/pipeline2.py b/mongo/pipeline2.py new file mode 100644 index 0000000..7f9989f --- /dev/null +++ b/mongo/pipeline2.py @@ -0,0 +1,15 @@ +pipeline = [ + { + '$geoNear': { + 'near': { + 'type': 'Point', + 'coordinates': [ + -78.9, 35.9 + ] + }, + 'distanceField': 'distance', + 'maxDistance': 160934.4, + 'spherical': True + } + } +]