{"id":311348,"date":"2020-10-12T21:00:32","date_gmt":"2020-10-12T21:00:32","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=311348"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=311348","title":{"rendered":"OTUS. \u041a\u0443\u0440\u0441 NoSQL. \u0414\u043e\u043c\u0430\u0448\u043d\u044f\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u21163 (MongoDB)"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/523182\/\"><b>\u0426\u0435\u043b\u044c: <\/b><br \/>  \u043e\u0441\u0432\u043e\u0438\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 mongodb<\/p>\n<p>  <b>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/b>  <\/p>\n<ul>\n<li>\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c MongoDB \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432: \u0412\u041c, \u0434\u043e\u043a\u0435\u0440;<\/li>\n<li>\u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u043c\u0438;<\/li>\n<li>\u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/li>\n<li>\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/li>\n<\/ul>\n<p>  <a name=\"habracut\"><\/a><br \/>  <b>\u0420\u0435\u0448\u0435\u043d\u0438\u0435<\/b><\/p>\n<p>  <b>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430<\/b><\/p>\n<p>  MongoDB \u0431\u044b\u043b\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u043e \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0435 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c Docker-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u043e\u0431\u043e\u043b\u043e\u0447\u043a\u0438 <a href=\"https:\/\/www.portainer.io\" rel=\"nofollow\">www.portainer.io<\/a>.<\/p>\n<p>  <b>\u0417\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438<\/b><\/p>\n<p>  \u042f \u0432 \u043f\u043e\u0438\u0441\u043a\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u044b\u0445 \u0434\u043b\u044f \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 MongoDB, \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0441\u044f \u043d\u0430 \u043d\u0430\u0431\u043e\u0440\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 NASA <a href=\"https:\/\/data.nasa.gov\/resource\/y77d-th95.json\" rel=\"nofollow\">\u00abEarth Meteorite Landings\u00bb<\/a> (1000 \u0441\u0442\u0440\u043e\u043a \u0441\u043e \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f\u043c\u0438 \u043e\u0431 \u0443\u043f\u0430\u0432\u0448\u0438\u0445 \u043d\u0430 \u0417\u0435\u043c\u043b\u044e \u043c\u0435\u0442\u0435\u043e\u0440\u0438\u0442\u0430\u0445, \u0438\u0437 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f <a href=\"https:\/\/github.com\/jdorfman\/awesome-json-datasets\" rel=\"nofollow\">https:\/\/github.com\/jdorfman\/awesome-json-datasets<\/a>.<\/p>\n<p>  <i>\u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/i>: \u043d\u0430\u0448\u0435\u043b \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u043b\u043d\u044b\u0435 (45.7K) \u0441\u0432\u0435\u0434\u0435\u043d\u0438\u044f <a href=\"https:\/\/data.nasa.gov\/Space-Science\/Meteorite-Landings\/gh4g-9sfh\" rel=\"nofollow\">https:\/\/data.nasa.gov\/Space-Science\/Meteorite-Landings\/gh4g-9sfh<\/a>, \u043d\u043e \u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u0432 JSON \u0447\u0435\u0440\u0435\u0437 \u0438\u0445 API \u0434\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e 1000 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 (\u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e), \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u043b\u043e\u043f\u0430\u0442\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e CSV \u0444\u0430\u0439\u043b\u0430 <a href=\"https:\/\/data.nasa.gov\/api\/views\/gh4g-9sfh\/rows.csv?accessType=DOWNLOAD\" rel=\"nofollow\">https:\/\/data.nasa.gov\/api\/views\/gh4g-9sfh\/rows.csv?accessType=DOWNLOAD<\/a>?<\/p>\n<p>  <i>\u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/i>: \u0443\u043f\u0441, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 JSON, \u043d\u043e \u044d\u0442\u043e \u0445\u0430\u043a. \u0418\u0441\u043a\u0440\u0435\u043d\u043d\u0435 \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0432 \u044d\u0442\u043e\u043c \u043d\u0435\u0442 SQL-\u0438\u043d\u044a\u0435\u043a\u0446\u0438\u0438<\/p>\n<p>  <a href=\"https:\/\/data.nasa.gov\/api\/id\/gh4g-9sfh.json?%24select=%60name%60,%60id%60,%60nametype%60,%60recclass%60,%60mass%60,%60fall%60,%60year%60,%60reclat%60,%60reclong%60,%60geolocation%60&amp;%24order=%60:id%60+ASC&amp;%24limit=46000&amp;%24offset=0\" rel=\"nofollow\">https:\/\/data.nasa.gov\/api\/id\/gh4g-9sfh.json?$select=`name`,`id`,`nametype`,`recclass`,`mass`,`fall`,`year`,`reclat`,`reclong`,`geolocation`&amp;$order=`:id`+ASC&amp;$limit=46000&amp;$offset=0<\/a><\/p>\n<pre><code class=\"bash\">wc .\/gh4g-9sfh.json      45716   128491 10441343 .\/gh4g-9sfh.json <\/code><\/pre>\n<p>  \u0414\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0432 \u0441\u0435\u0442\u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043b\u0438\u0435\u043d\u0442\u0430 \u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b:<\/p>\n<pre><code class=\"bash\">wget -qO - https:\/\/www.mongodb.org\/static\/pgp\/server-4.4.asc | sudo apt-key add - echo &quot;deb http:\/\/repo.mongodb.org\/apt\/debian buster\/mongodb-org\/4.4 main&quot; | sudo tee \/etc\/apt\/sources.list.d\/mongodb-org-4.4.list  sudo apt-get update sudo apt-get install -y mongodb-org-shell sudo apt-get install -y mongodb-org-tools <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"bash\">mongo nosql-2020.otus --port 32789      MongoDB shell version v4.4.1     connecting to: mongodb:\/\/nosql-2020.otus:32789\/test?compressors=disabled&amp;gssapiServiceName=mongodb     Implicit session: session { &quot;id&quot; : UUID(&quot;5ff24788-0710-4a1a-821f-7acb2eddfb4f&quot;) }     MongoDB server version: 4.4.1     Welcome to the MongoDB shell.     For interactive help, type &quot;help&quot;.     For more comprehensive documentation, see             https:\/\/docs.mongodb.com\/     Questions? Try the MongoDB Developer Community Forums             https:\/\/community.mongodb.com <\/code><\/pre>\n<p>  \u0418\u043c\u043f\u043e\u0440\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u0443\u044e:<\/p>\n<pre><code class=\"bash\">mongoimport --host nosql-2020.otus  --db &quot;otus_003&quot; --port 32789 --collection eml45k --jsonArray --file .\/003_MONGODB.files\/gh4g-9sfh.json          2020-10-12T01:01:13.826+0100    connected to: mongodb:\/\/nosql-2020.otus:32789\/     2020-10-12T01:01:16.827+0100    [#######.................] otus_003.eml45k      2.99MB\/9.96MB (30.0%)     2020-10-12T01:01:19.827+0100    [###############.........] otus_003.eml45k      6.44MB\/9.96MB (64.6%)     2020-10-12T01:01:22.827+0100    [#######################.] otus_003.eml45k      9.81MB\/9.96MB (98.5%)     2020-10-12T01:01:23.035+0100    [########################] otus_003.eml45k      9.96MB\/9.96MB (100.0%)     2020-10-12T01:01:23.035+0100    45716 document(s) imported successfully. 0 document(s) failed to import.<\/code><\/pre>\n<p>  <i>\u0417\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435<\/i>: 10 \u0441\u0435\u043a\u0443\u043d\u0434 \u043d\u0430 \u0432\u0441\u0435 \u043f\u0440\u043e \u0432\u0441\u0435, \u0437\u0430\u0431\u0430\u0432\u043d\u0435\u043d\u044c\u043a\u043e<\/p>\n<p>  <b>\u0412\u044b\u0431\u043e\u0440\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/b><\/p>\n<pre><code class=\"bash\">&gt; show databases admin     0.000GB config    0.000GB local     0.000GB otus_003  0.000GB test      0.000GB &gt; use otus_003 switched to db otus_003 &gt; show collections em l<\/code><\/pre>\n<p>  \u0418\u0449\u0435\u043c \u043c\u0435\u0442\u0435\u043e\u0440\u0438\u0442 \u043f\u043e \u0437\u0430\u0432\u0435\u0434\u043e\u043c\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e\u043c\u0443 \u0438\u043c\u0435\u043d\u0438:<\/p>\n<pre><code class=\"bash\">&gt; db.eml45k.find({name:&quot;Bjelaja Zerkov&quot;})      { &quot;_id&quot; : ObjectId(&quot;5f8380a91c0ab84b54bfe394&quot;), &quot;name&quot; : &quot;Bjelaja Zerkov&quot;, &quot;id&quot; : &quot;5063&quot;, &quot;nametype&quot; : &quot;Valid&quot;, &quot;recclass&quot; : &quot;H6&quot;, &quot;mass&quot; : &quot;1850&quot;, &quot;fall&quot; : &quot;Fell&quot;, &quot;year&quot; : &quot;1796-01-01T00:00:00.000&quot;, &quot;reclat&quot; : &quot;49.783330&quot;, &quot;reclong&quot; : &quot;30.166670&quot;, &quot;geolocation&quot; : { &quot;latitude&quot; : &quot;49.78333&quot;, &quot;longitude&quot; : &quot;30.16667&quot; } } <\/code><\/pre>\n<p>  \u0418\u0449\u0435\u043c \u043c\u0435\u0442\u0435\u043e\u0440\u0438\u0442 \u043f\u043e \u0437\u0430\u0432\u0435\u0434\u043e\u043c\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u043c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c:<\/p>\n<pre><code class=\"bash\">&gt; db.eml45k.find({ &quot;geolocation&quot; : { &quot;latitude&quot; : &quot;44.83333&quot; , &quot;longitude&quot; : &quot;95.16667&quot; } })  { &quot;_id&quot; : ObjectId(&quot;5f8380a91c0ab84b54bfe322&quot;), &quot;name&quot; : &quot;Adzhi-Bogdo (stone)&quot;, &quot;id&quot; : &quot;390&quot;, &quot;nametype&quot; : &quot;Valid&quot;, &quot;recclass&quot; : &quot;LL3-6&quot;, &quot;mass&quot; : &quot;910&quot;, &quot;fall&quot; : &quot;Fell&quot;, &quot;year&quot; : &quot;1949-01-01T00:00:00.000&quot;, &quot;reclat&quot; : &quot;44.833330&quot;, &quot;reclong&quot; : &quot;95.166670&quot;, &quot;geolocation&quot; : { &quot;latitude&quot; : &quot;44.83333&quot;, &quot;longitude&quot; : &quot;95.16667&quot; } } <\/code><\/pre>\n<p>  \u0412\u044b\u0431\u043e\u0440\u043a\u0430 \u0441\u043f\u0438\u0441\u043a\u0430 \u0443\u043f\u0430\u0432\u0448\u0438\u0445 \u043c\u0435\u0442\u0435\u043e\u0440\u0438\u0442\u043e\u0432 \u0441 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u043e\u0439 \u043f\u043e \u0433\u043e\u0434\u0443 \u043f\u0430\u0434\u0435\u043d\u0438\u044f (\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043f\u043e\u0447\u0435\u043c\u0443 \u0443 NASA \u043d\u0435\u0442 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u0430\u0434\u0435\u043d\u0438\u044f \u043f\u043e \u0413\u0440\u0438\u043d\u0432\u0438\u0447\u0443) \u0438 c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u043f\u0438\u0441\u043a\u0430 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c\u044b\u0445 \u043f\u043e\u043b\u0435\u0439:  <\/p>\n<pre><code class=\"bash\">&gt; db.eml45k.find( { }, {year: 1, id: 1, name: 1, _id: 0 }).sort( { year: -1 } )  { &quot;name&quot; : &quot;Northwest Africa 7701&quot;, &quot;id&quot; : &quot;57150&quot;, &quot;year&quot; : &quot;2101-01-01T00:00:00.000&quot; } { &quot;name&quot; : &quot;Chelyabinsk&quot;, &quot;id&quot; : &quot;57165&quot;, &quot;year&quot; : &quot;2013-01-01T00:00:00.000&quot; } { &quot;name&quot; : &quot;Northwest Africa 7755&quot;, &quot;id&quot; : &quot;57166&quot;, &quot;year&quot; : &quot;2013-01-01T00:00:00.000&quot; } { &quot;name&quot; : &quot;Northwest Africa 7812&quot;, &quot;id&quot; : &quot;57258&quot;, &quot;year&quot; : &quot;2013-01-01T00:00:00.000&quot; } { &quot;name&quot; : &quot;Northwest Africa 7822&quot;, &quot;id&quot; : &quot;57268&quot;, &quot;year&quot; : &quot;2013-01-01T00:00:00.000&quot; } { &quot;name&quot; : &quot;Northwest Africa 7856&quot;, &quot;id&quot; : &quot;57421&quot;, &quot;year&quot; : &quot;2013-01-01T00:00:00.000&quot; } { &quot;name&quot; : &quot;Northwest Africa 7855&quot;, &quot;id&quot; : &quot;57420&quot;, &quot;year&quot; : &quot;2013-01-01T00:00:00.000&quot; } { &quot;name&quot; : &quot;Northwest Africa 7857&quot;, &quot;id&quot; : &quot;57422&quot;, &quot;year&quot; : &quot;2013-01-01T00:00:00.000&quot; } { &quot;name&quot; : &quot;Northwest Africa 7858&quot;, &quot;id&quot; : &quot;57423&quot;, &quot;year&quot; : &quot;2013-01-01T00:00:00.000&quot; } { &quot;name&quot; : &quot;Northwest Africa 7861&quot;, &quot;id&quot; : &quot;57425&quot;, &quot;year&quot; : &quot;2013-01-01T00:00:00.000&quot; } { &quot;name&quot; : &quot;Northwest Africa 7862&quot;, &quot;id&quot; : &quot;57426&quot;, &quot;year&quot; : &quot;2013-01-01T00:00:00.000&quot; } { &quot;name&quot; : &quot;Northwest Africa 7863&quot;, &quot;id&quot; : &quot;57427&quot;, &quot;year&quot; : &quot;2013-01-01T00:00:00.000&quot; } { &quot;name&quot; : &quot;Battle Mountain&quot;, &quot;id&quot; : &quot;56133&quot;, &quot;year&quot; : &quot;2012-01-01T00:00:00.000&quot; } { &quot;name&quot; : &quot;Sutter's Mill&quot;, &quot;id&quot; : &quot;55529&quot;, &quot;year&quot; : &quot;2012-01-01T00:00:00.000&quot; } { &quot;name&quot; : &quot;Antelope&quot;, &quot;id&quot; : &quot;57455&quot;, &quot;year&quot; : &quot;2012-01-01T00:00:00.000&quot; } { &quot;name&quot; : &quot;Catalina 009&quot;, &quot;id&quot; : &quot;57173&quot;, &quot;year&quot; : &quot;2012-01-01T00:00:00.000&quot; } { &quot;name&quot; : &quot;Jiddat al Harasis 799&quot;, &quot;id&quot; : &quot;57428&quot;, &quot;year&quot; : &quot;2012-01-01T00:00:00.000&quot; } { &quot;name&quot; : &quot;Johannesburg&quot;, &quot;id&quot; : &quot;55765&quot;, &quot;year&quot; : &quot;2012-01-01T00:00:00.000&quot; } { &quot;name&quot; : &quot;Ksar Ghilane 011&quot;, &quot;id&quot; : &quot;55606&quot;, &quot;year&quot; : &quot;2012-01-01T00:00:00.000&quot; } { &quot;name&quot; : &quot;Ksar Ghilane 010&quot;, &quot;id&quot; : &quot;55605&quot;, &quot;year&quot; : &quot;2012-01-01T00:00:00.000&quot; } Type &quot;it&quot; for more &gt; <\/code><\/pre>\n<p>  \u0427\u0442\u043e-\u0442\u043e \u044f \u043d\u0435 \u043d\u0430\u0448\u0435\u043b? \u043a\u0430\u043a \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0434\u0432\u0430 \u043f\u043e\u043b\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0440\u0438 \u0432\u044b\u0431\u043e\u0440\u043a\u0435:<\/p>\n<pre><code class=\"bash\">&quot;geolocation&quot; : { &quot;latitude&quot; : &quot;49.78333&quot;, &quot;longitude&quot; : &quot;30.16667&quot; }  <\/code><\/pre>\n<p>  \u0432 \u0442\u043e\u0447\u043a\u0443 (\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u043e \u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439 (<a href=\"https:\/\/docs.mongodb.com\/manual\/geospatial-queries\/#geospatial-legacy\" rel=\"nofollow\">https:\/\/docs.mongodb.com\/manual\/geospatial-queries\/#geospatial-legacy<\/a>, \u0442\u043e \u0435\u0441\u0442\u044c<\/p>\n<pre><code class=\"plaintext\">&lt; field &gt;: [&lt; longitude &gt;, &lt; latitude &gt;]):<\/code><\/pre>\n<pre><code class=\"bash\">&quot;geolocation&quot; : { &quot;type&quot; : &quot;Point&quot;, &quot;coordinates&quot; : [  30.16667 , 49.78333 ] } } <\/code><\/pre>\n<p>  \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0440\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0435, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c (\u043a\u0442\u043e \u0437\u043d\u0430\u0435\u0442?) \u0447\u0442\u043e-\u0442\u043e \u043f\u043e \u0442\u0438\u043f\u0443 \u044d\u0442\u043e\u0433\u043e:<\/p>\n<pre><code class=\"bash\">&gt; db.eml45k.find({      [          {$toDouble: &quot;$geolocation.longitude&quot;} ,         {$toDouble: &quot;$geolocation.latitude&quot;}      ] : {         $geoWithin: {             $geometry: {                 type : &quot;Polygon&quot; ,                 coordinates: [[                     ... ,                 ]]             }         }     } })  <\/code><\/pre>\n<p>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u043e\u0437\u0434\u0430\u043b \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043f\u043e\u043b\u0435 \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"bash\">db.eml45k.updateMany(      {},     [{         $set: {             &quot;pointed_geolocation.type&quot; : &quot;Point&quot;,             &quot;pointed_geolocation.coordinates&quot; : [                  { $toDouble : &quot;$geolocation.longitude&quot; } ,                  { $toDouble: &quot;$geolocation.latitude&quot; }              ]         }     }] );  { &quot;acknowledged&quot; : true, &quot;matchedCount&quot; : 45716, &quot;modifiedCount&quot; : 45716 } <\/code><\/pre>\n<p>  \u0438 \u043c\u044b \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043c\u043e\u0436\u0435\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u043e\u0438\u0441\u043a\u0438 \u043d\u0435\u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u043c\u0435\u0442\u0435\u043e\u0440\u0438\u0442\u043e\u0432, \u0443\u043f\u0430\u0432\u0448\u0438\u0445 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u0440\u0430\u0439\u043e\u043d\u0435:<\/p>\n<pre><code class=\"bash\">&gt; db.eml45k.find({      &quot;pointed_geolocation.coordinates&quot; : {         $geoWithin: {             $geometry: {                 type : &quot;Polygon&quot; ,                 coordinates: [[                     [ 47.0 , 33.0  ],                      [ 47.0 , 65.0 ],                      [ 169.0 , 65.0 ],                     [ 169.0 ,  33.0 ],                     [ 47.0 , 33.0 ]                 ]]             }         }     },     'fall': 'Fell' }, {      year: {$year: { &quot;$toDate&quot;: &quot;$year&quot;}},      &quot;pointed_geolocation.coordinates&quot;: 1,      name: 1,      _id: 0  }).sort( { year: -1 } )<\/code><\/pre>\n<p>  { \u00abname\u00bb: \u00abChelyabinsk\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 61.11667, 54.81667 ] }, \u00abyear\u00bb: 2013 }<br \/>  { \u00abname\u00bb: \u00abDashoguz\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 59.685, 41.98444 ] }, \u00abyear\u00bb: 1998 }<br \/>  { \u00abname\u00bb: \u00abKunya-Urgench\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 59.2, 42.25 ] }, \u00abyear\u00bb: 1998 }<br \/>  { \u00abname\u00bb: \u00abSterlitamak\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 55.98333, 53.66667 ] }, \u00abyear\u00bb: 1990 }<br \/>  { \u00abname\u00bb: \u00abUndulung\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 124.76667, 66.13889 ] }, \u00abyear\u00bb: 1986 }<br \/>  { \u00abname\u00bb: \u00abOmolon\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 161.80833, 64.02 ] }, \u00abyear\u00bb: 1981 }<br \/>  { \u00abname\u00bb: \u00abYardymly\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 48.25, 38.93333 ] }, \u00abyear\u00bb: 1959 }<br \/>  { \u00abname\u00bb: \u00abVengerovo\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 77.26667, 56.13333 ] }, \u00abyear\u00bb: 1950 }<br \/>  { \u00abname\u00bb: \u00abKunashak\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 61.36667, 55.78333 ] }, \u00abyear\u00bb: 1949 }<br \/>  { \u00abname\u00bb: \u00abKrasnyi Klyuch\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 56.08333, 54.33333 ] }, \u00abyear\u00bb: 1946 }<br \/>  { \u00abname\u00bb: \u00abLavrentievka\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 51.56667, 52.45 ] }, \u00abyear\u00bb: 1938 }<br \/>  { \u00abname\u00bb: \u00abPavlodar (stone)\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 77.03333, 52.3 ] }, \u00abyear\u00bb: 1938 }<br \/>  { \u00abname\u00bb: \u00abKainsaz\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 53.25, 55.43333 ] }, \u00abyear\u00bb: 1937 }<br \/>  { \u00abname\u00bb: \u00abIchkala\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 82.93333, 58.2 ] }, \u00abyear\u00bb: 1936 }<br \/>  { \u00abname\u00bb: \u00abNikolaevka\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 78.63333, 52.45 ] }, \u00abyear\u00bb: 1935 }<br \/>  { \u00abname\u00bb: \u00abBrient\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 59.31667, 52.13333 ] }, \u00abyear\u00bb: 1933 }<br \/>  { \u00abname\u00bb: \u00abPesyanoe\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 66.08333, 55.5 ] }, \u00abyear\u00bb: 1933 }<br \/>  { \u00abname\u00bb: \u00abKuznetzovo\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 75.33333, 55.2 ] }, \u00abyear\u00bb: 1932 }<br \/>  { \u00abname\u00bb: \u00abBoriskino\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 52.48333, 54.23333 ] }, \u00abyear\u00bb: 1930 }<br \/>  { \u00abname\u00bb: \u00abKhmelevka\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 75.33333, 56.75 ] }, \u00abyear\u00bb: 1929 }<br \/>  Type \u00abit\u00bb for more<br \/>  &gt; it<br \/>  { \u00abname\u00bb: \u00abMamra Springs\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 62.08333, 45.21667 ] }, \u00abyear\u00bb: 1927 }<br \/>  { \u00abname\u00bb: \u00abDemina\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 84.76667, 51.46667 ] }, \u00abyear\u00bb: 1911 }<br \/>  { \u00abname\u00bb: \u00abKrutikha\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 77, 56.8 ] }, \u00abyear\u00bb: 1906 }<br \/>  { \u00abname\u00bb: \u00abBarnaul\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 84.08333, 52.73333 ] }, \u00abyear\u00bb: 1904 }<br \/>  { \u00abname\u00bb: \u00abTyumen\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 65.53333, 57.16667 ] }, \u00abyear\u00bb: 1903 }<br \/>  { \u00abname\u00bb: \u00abOchansk\u00bb, \u00abpointed_geolocation\u00bb: { \u00abcoordinates\u00bb: [ 55.26667, 57.78333 ] }, \u00abyear\u00bb: 1887 }<\/p>\n<p>  \u0421\u0442\u0440\u0430\u043d\u043d\u043e, \u044f \u043d\u0435 \u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u0427\u0435\u043b\u044f\u0431\u0438\u043d\u0441\u043a\u0438\u0439 \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442\u0441\u044f \u0432 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u00ab\u043d\u0430\u0439\u0434\u0435\u043d\u00bb.<\/p>\n<p>  \u0410\u0433\u0440\u0435\u0433\u0438\u0440\u0443\u0435\u043c \u0438 \u043d\u0430\u0439\u0434\u0435\u043c \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e \u0438 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0442:<\/p>\n<pre><code class=\"bash\">db.eml45k.aggregate([ { $match: {      &quot;pointed_geolocation.coordinates&quot; : {         $geoWithin: {             $geometry: {                 type : &quot;Polygon&quot; ,                 coordinates: [[                     [ 47.0 , 33.0  ],                      [ 47.0 , 65.0 ],                      [ 169.0 , 65.0 ],                     [ 169.0 ,  33.0 ],                     [ 47.0 , 33.0 ]                 ]]             }         }     } } },     {&quot;$group&quot; : {_id: &quot;$fall&quot;, count: { $sum: 1 }}} ])  { &quot;_id&quot; : &quot;Fell&quot;, &quot;count&quot; : 26 } { &quot;_id&quot; : &quot;Found&quot;, &quot;count&quot; : 63 } <\/code><\/pre>\n<p>  \u0418\u0442\u043e\u0433\u043e \u043d\u0430\u0439\u0434\u0435\u043d\u043e 63 \u0438\u0437 89, \u0430 __26__ \u2014 __\u043d\u0435__ \u043d\u0430\u0448\u043b\u0438, \u0442\u0430\u043a \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0448\u0430\u043d\u0441 \ud83d\ude42<\/p>\n<p>  <b>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432<\/b><\/p>\n<p>  \u0423\u0434\u0430\u043b\u0438\u043c \u0432\u0441\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043e\u0442 \u043f\u0440\u043e\u0448\u043b\u044b\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432:<\/p>\n<pre><code class=\"bash\">db.eml45k.dropIndexes()  {         &quot;nIndexesWas&quot; : 1,         &quot;msg&quot; : &quot;non-_id indexes dropped for collection&quot;,         &quot;ok&quot; : 1 } <\/code><\/pre>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043e\u0446\u0435\u043d\u043e\u0447\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u0430:<\/p>\n<pre><code class=\"bash\">db.eml45k.find({      &quot;pointed_geolocation.coordinates&quot; : {         $geoWithin: {             $geometry: {                 type : &quot;Polygon&quot; ,                 coordinates: [[                     [ 47.0 , 33.0  ],                      [ 47.0 , 65.0 ],                      [ 169.0 , 65.0 ],                     [ 169.0 ,  33.0 ],                     [ 47.0 , 33.0 ]                 ]]             }         }     } }).explain(&quot;executionStats&quot;).executionStats.executionTimeMillis ... 110 ... 110 ... 109 <\/code><\/pre>\n<p>  \u0418\u0442\u043e\u0433 \u2014 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c 110 \u0441\u0435\u043a\u0443\u043d\u0434.<\/p>\n<p>  \u041f\u0440\u043e\u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u0443\u0435\u043c:  <\/p>\n<pre><code class=\"bash\"> db.eml45k.createIndex( { &quot;pointed_geolocation&quot; : &quot;2dsphere&quot; } )      {         &quot;ok&quot; : 0,         &quot;errmsg&quot; : &quot;Index build failed: 98b9ead2-c156-4312-81af-1adf5896e3c9: Collection otus_003.eml45k ( 6db2d178-61b5-4627-8512-fcf919fe596f ) :: caused by :: Can't extract geo keys: { _id: ObjectId('5f838e30fb89bd9d553ae27f'), name: \\&quot;Bulls Run\\&quot;, id: \\&quot;5163\\&quot;, nametype: \\&quot;Valid\\&quot;, recclass: \\&quot;Iron?\\&quot;, mass: \\&quot;2250\\&quot;, fall: \\&quot;Fell\\&quot;, year: \\&quot;1964-01-01T00:00:00.000\\&quot;, pointed_geolocation: { type: \\&quot;Point\\&quot;, coordinates: [ null, null ] } }  Point must only contain numeric elements&quot;,         &quot;code&quot; : 16755,         &quot;codeName&quot; : &quot;Location16755&quot;     }  <\/code><\/pre>\n<p>  \u041e\u0448\u0438\u0431\u043a\u0430 \u0438\u0437-\u0437\u0430 NULL-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u044f \u0447\u0442\u043e-\u0442\u043e \u043d\u0435 \u043d\u0430\u0448\u0435\u043b \u0441\u0445\u043e\u0434\u0443 \u043a\u0430\u043a (\u043a\u0442\u043e \u0437\u043d\u0430\u0435\u0442?) \u0435\u0435 \u043f\u0440\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0443\u0434\u0430\u043b\u044e \u043a\u043b\u044e\u0447\u0438 \u044d\u0442\u0438:<\/p>\n<pre><code class=\"bash\">db.eml45k.updateMany(     { &quot;pointed_geolocation.coordinates&quot; : [ null , null ] },          [{                  $set: { &quot;pointed_geolocation&quot;: null }     }]  ); <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0431\u0443\u0435\u043c \u043e\u043f\u044f\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441<\/p>\n<pre><code class=\"bash\">db.eml45k.createIndex( { &quot;pointed_geolocation&quot; : &quot;2dsphere&quot; } )          {         &quot;ok&quot; : 0,         &quot;errmsg&quot; : &quot;Index build failed: d33b31d4-4778-4537-a087-58b7bd1968f3: Collection otus_003.eml45k ( 6db2d178-61b5-4627-8512-fcf919fe596f ) :: caused by :: Can't extract geo keys: { _id: ObjectId('5f838e35fb89bd9d553b3b8f'), name: \\&quot;Meridiani Planum\\&quot;, id: \\&quot;32789\\&quot;, nametype: \\&quot;Valid\\&quot;, recclass: \\&quot;Iron, IAB complex\\&quot;, fall: \\&quot;Found\\&quot;, year: \\&quot;2005-01-01T00:00:00.000\\&quot;, reclat: \\&quot;-1.946170\\&quot;, reclong: \\&quot;354.473330\\&quot;, geolocation: { latitude: \\&quot;-1.94617\\&quot;, longitude: \\&quot;354.47333\\&quot; }, pointed_geolocation: { type: \\&quot;Point\\&quot;, coordinates: [ 354.47333, -1.94617 ] } }  longitude\/latitude is out of bounds, lng: 354.473 lat: -1.94617&quot;,         &quot;code&quot; : 16755,         &quot;codeName&quot; : &quot;Location16755&quot;     } <\/code><\/pre>\n<p>  \u041e\u0448\u0438\u0431\u043a\u0430 __longitude\/latitude is out of bounds, lng: 354.473 lat: -1.94617__ \u0438 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <a href=\"https:\/\/docs.mongodb.com\/manual\/geospatial-queries\/#geospatial-legacy\" rel=\"nofollow\">https:\/\/docs.mongodb.com\/manual\/geospatial-queries\/#geospatial-legacy<\/a><\/p>\n<pre><code class=\"plaintext\">     Valid longitude values are between -180 and 180, both inclusive.     Valid latitude values are between -90 and 90, both inclusive.<\/code><\/pre>\n<p>  \u0438 354.47333 \u043d\u0435 \u0432\u0445\u043e\u0434\u0438\u0442 \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u043e\u0442 -180 \u0434\u043e 180.<\/p>\n<p>  \u041e\u0447\u0435\u043d\u044c \u0441\u0442\u0440\u0430\u043d\u043d\u043e, \u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u0443\u043c\u0430\u043b \u0442\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u0430\u0432\u043a\u0443 \u0432\u0435\u0437\u0434\u0435 \u043d\u0430 \u043c\u0438\u043d\u0443\u0441 180 \u0441\u0434\u0435\u043b\u0430\u0442\u044c <\/p>\n<pre><code class=\"bash\">(`$subtract: [{ $toDouble : &quot;$geolocation.longitude&quot; }, 180.0]`) <\/code><\/pre>\n<p>  , \u043d\u043e \u0432 \u0438\u0442\u043e\u0433\u0435 \u043d\u0435 \u0432\u0441\u0435 \u0442\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e.<\/p>\n<p>  \u041a\u0430\u043a\u0438\u0435 \u0434\u043e\u043b\u0433\u043e\u0442\u044b \u043d\u0435 \u0432 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d\u0435:<\/p>\n<pre><code class=\"bash\">db.eml45k.find({&quot;pointed_geolocation.coordinates.0&quot;: {$lt: -180}} ) # \u043d\u0435\u0442 \u0442\u0430\u043a\u0438\u0445, \u0442\u0430\u043a \u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c db.eml45k.find({&quot;pointed_geolocation.coordinates.0&quot;: {$lt: 0}} ) #  \u0442\u0430\u043a\u0438\u0435 \u0435\u0441\u0442\u044c, \u0442\u0430\u043a \u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c db.eml45k.find({&quot;pointed_geolocation.coordinates.0&quot;: {$gt: 180}} ) # \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d, \u0438 \u0442\u0430\u043a \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c       { &quot;_id&quot; : ObjectId(&quot;5f838e35fb89bd9d553b3b8f&quot;), &quot;name&quot; : &quot;Meridiani Planum&quot;, &quot;id&quot; : &quot;32789&quot;, &quot;nametype&quot; : &quot;Valid&quot;, &quot;recclass&quot; : &quot;Iron, IAB complex&quot;, &quot;fall&quot; : &quot;Found&quot;, &quot;year&quot; : &quot;2005-01-01T00:00:00.000&quot;, &quot;reclat&quot; : &quot;-1.946170&quot;, &quot;reclong&quot; : &quot;354.473330&quot;, &quot;geolocation&quot; : { &quot;latitude&quot; : &quot;-1.94617&quot;, &quot;longitude&quot; : &quot;354.47333&quot; }, &quot;pointed_geolocation&quot; : { &quot;type&quot; : &quot;Point&quot;, &quot;coordinates&quot; : [ 354.47333, -1.94617 ] } }  <\/code><\/pre>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u0435\u043e\u0440\u0438\u0442 \u0438\u043c\u0435\u0435\u0442 \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b. \u041f\u043e\u0438\u0441\u043a\u0430\u0432, \u0432\u044b\u044f\u0441\u043d\u0438\u043b, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u0435\u043e\u0440\u0438\u0442 Meridiani Planum \u0431\u044b\u043b \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043d\u0430\u0439\u0434\u0435\u043d \u043c\u0430\u0440\u0441\u043e\u0445\u043e\u0434\u043e\u043c Opportunity \u0432 2005 \u0433\u043e\u0434\u0443<br \/>   (<a href=\"http:\/\/old.mirf.ru\/Articles\/art2427_2.htm\" rel=\"nofollow\">http:\/\/old.mirf.ru\/Articles\/art2427_2.htm<\/a>). \u042d\u0442\u043e (<b>\u0412\u041d\u0418\u041c\u0410\u041d\u0418\u0415<\/b>) \u043c\u0430\u0440\u0441\u0438\u0430\u043d\u0441\u043a\u0438\u0439 \u043c\u0435\u0442\u0435\u043e\u0440\u0438\u0442, \u043d\u0430\u0439\u0434\u0435\u043d (<b>\u0412\u041d\u0418\u041c\u0410\u041d\u0418\u0415<\/b>) \u043d\u0430 \u041c\u0430\u0440\u0441\u0435. \u0412\u043e\u0442 NASA \u0448\u0443\u0442\u043d\u0438\u043a\u0438.<\/p>\n<p>  \u0423\u0434\u0430\u043b\u0438\u043c \u0435\u0433\u043e \u0438\u0437 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438.<\/p>\n<pre><code class=\"bash\">db.eml45k.remove({&quot;id&quot; : &quot;32789&quot;}) WriteResult({ &quot;nRemoved&quot; : 1 }) <\/code><\/pre>\n<p>  \u0418\u043d\u0434\u0435\u043a\u0441\u0438\u0440\u0443\u0435\u043c  <\/p>\n<pre><code class=\"bash\">&gt; db.eml45k.createIndex( { &quot;pointed_geolocation&quot; : &quot;2dsphere&quot; } ) {         &quot;createdCollectionAutomatically&quot; : false,         &quot;numIndexesBefore&quot; : 1,         &quot;numIndexesAfter&quot; : 2,         &quot;ok&quot; : 1 } <\/code><\/pre>\n<p>  \u0417\u0430\u043c\u0435\u0440\u044f\u0435\u043c<\/p>\n<pre><code class=\"bash\">db.eml45k.find({      &quot;pointed_geolocation.coordinates&quot; : {         $geoWithin: {             $geometry: {                 type : &quot;Polygon&quot; ,                 coordinates: [[                     [ 47.0 , 33.0  ],                      [ 47.0 , 65.0 ],                      [ 169.0 , 65.0 ],                     [ 169.0 ,  33.0 ],                     [ 47.0 , 33.0 ]                 ]]             }         }     } }).explain(&quot;executionStats&quot;).executionStats.executionTimeMillis <\/code><\/pre>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430\u0445 104\u2026 107\u2026 106\u2026<\/p>\n<p>  \u041a\u0430\u043a-\u0442\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e, \u043d\u0435 \u043e\u0447\u0435\u043d\u044c-\u0442\u043e \u0438 \u0448\u0443\u0441\u0442\u0440\u0435\u0435.<\/p>\n<p>  \u0423\u0434\u0430\u043b\u0438\u043b \u0438\u043d\u0434\u0435\u043a\u0441, \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b.<\/p>\n<p>  \u0411\u0435\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0438 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u2014 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e.<\/p>\n<p>  \u041f\u0440\u043e\u0431\u0443\u044e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0427\u0435\u043b\u044f\u0431\u0438\u043d\u0441\u043a\u043e\u0433\u043e:<\/p>\n<pre><code class=\"bash\">db.eml45k.find(     {&quot;pointed_geolocation.coordinates&quot; : [ 61.11667, 54.81667 ]} ).explain(&quot;executionStats&quot;).executionStats.executionTimeMillis <\/code><\/pre>\n<p>  \u0431\u0435\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u0438 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u2014 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e.<\/p>\n<p>  \u041d\u0443\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u0435\u0435, \u0438\u043d\u0434\u0435\u043a\u0441 \u0436\u0435 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u0434\u043b\u044f \u043f\u043e\u043b\u044f <b>pointed_geolocation<\/b>, \u0430 \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442 <b>pointed_geolocation.coordinates<\/b><\/p>\n<p>  \u0412 \u0438\u0442\u043e\u0433\u0435, \u0437\u0430\u043f\u0440\u043e\u0441<\/p>\n<pre><code class=\"bash\">db.eml45k.find({      &quot;pointed_geolocation&quot; : {         $geoWithin: {             $geometry: {                 type : &quot;Polygon&quot; ,                 coordinates: [[                     [ 47.0 , 33.0  ],                      [ 47.0 , 65.0 ],                      [ 169.0 , 65.0 ],                     [ 169.0 ,  33.0 ],                     [ 47.0 , 33.0 ]                 ]]             }         }     } }).explain(&quot;executionStats&quot;).executionStats.executionTimeMillis <\/code><\/pre>\n<p>  \u0431\u0435\u0437 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 125, 123, 119, 123 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b, \u0430 \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c \u2014 7, 4, 4, 5. <\/p>\n<p>  \u0412\u0441\u0451 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c.<\/p>\n<p>  P.S. \u0414\u043e\u043c\u0430\u0448\u043a\u0443 \u0437\u0430\u0447\u043b\u0438.<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/523182\/\"> https:\/\/habr.com\/ru\/post\/523182\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/523182\/\"><b>\u0426\u0435\u043b\u044c: <\/b><br \/>  \u043e\u0441\u0432\u043e\u0438\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 mongodb<\/p>\n<p>  <b>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e:<\/b>  <\/p>\n<ul>\n<li>\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c MongoDB \u043e\u0434\u043d\u0438\u043c \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432: \u0412\u041c, \u0434\u043e\u043a\u0435\u0440;<\/li>\n<li>\u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u043c\u0438;<\/li>\n<li>\u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043d\u0430 \u0432\u044b\u0431\u043e\u0440\u043a\u0443 \u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/li>\n<li>\u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/li>\n<\/ul>\n<p>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-311348","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/311348","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=311348"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/311348\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=311348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=311348"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=311348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}