{"id":718,"date":"2021-10-21T22:46:46","date_gmt":"2021-10-21T22:46:46","guid":{"rendered":"https:\/\/scrutineer.co.kr\/wordpress\/?p=718"},"modified":"2021-10-22T04:18:14","modified_gmt":"2021-10-22T04:18:14","slug":"%eb%aa%bd%ea%b3%a0%eb%94%94%eb%b9%84-%ec%9d%b8-%ec%95%a1%ec%85%98-5%ec%9e%a5","status":"publish","type":"post","link":"https:\/\/scrutineer.co.kr\/wordpress\/index.php\/2021\/10\/21\/%eb%aa%bd%ea%b3%a0%eb%94%94%eb%b9%84-%ec%9d%b8-%ec%95%a1%ec%85%98-5%ec%9e%a5\/","title":{"rendered":"\ubabd\uace0\ub514\ube44 \uc778 \uc561\uc158 5\uc7a5"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\" style=\"font-size:30px\">\ucffc\ub9ac \uc791\uc131\ud558\uae30<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ub2e4\ub978 \ud234\uacfc \ub2e4\ub978 \uc810\uc740 \ucffc\ub9ac \uc5b8\uc5b4\uc5d0 \uc788\ub2e4. SQL\uacfc \uac19\uc774 \ud45c\uc900\ud654\ub41c \ucffc\ub9ac \uc5b8\uc5b4\ub97c \uc0ac\uc6a9\ud558\ub294 \uac83 \ub300\uc2e0\uc5d0 \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \ud504\ub85c\uadf8\ub798\ubc0d \uc5b8\uc5b4\uc640 \uac04\ub2e8\ud55c API\ub97c \uc0ac\uc6a9\ud574 \uc11c\ubc84\uc640 \uc5f0\uacb0\ud55c\ub2e4.<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">\uc804\uc790\uc0c1\uac70\ub798 \ub370\uc774\ud130 \ubaa8\ub378 \uc9c8\uc758<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>findOne Vs find \ucffc\ub9ac <\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">product = db.products.findOne({'slug':'wheel-barrow-9092'})\ndb.categories.findOne({'_id': product['main_cat_id']})\ndb.reviews.find({'product_id':product['_id']})<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">findOne : \ub3c4\ud050\uba3c\ud2b8 \ubc18\ud658 (= db.products.find({&#8216;slug&#8217;:&#8217;wheel-barrow-9092&#8242;}).limit(1))<br>find : \ucee4\uc11c \uac1d\uccb4 \ubc18\ud658 =&gt; \uc5ec\ub7ec \uac1c\uc758 \uacb0\uacfc \ub3c4\ud050\uba3c\ud2b8\uac00 \ud544\uc694\ud558\ub2e4\uba74 find \uc0ac\uc6a9<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>skip, limit \uadf8\ub9ac\uace0 \ucffc\ub9ac \uc635\uc158<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">db.reviews.find({'product_id':product['_id']}).skip(0).limit(12)\n\/\/ \uac01 \ub9ac\ubdf0\uc5d0 \ucd94\ucc9c\uc218\uc758 \uac1c\uc218\uac00 \ub9ce\uc740 \uc21c\uc11c\ub300\ub85c \uc815\ub82c\ndb.reviews.find({'product_id':product['_id']}).sort({'helpful_votes':-1}).limit(12)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">skip, limit \ud398\uc774\uc9d5 \ucc98\ub9ac\uc5d0 \uc774\uc6a9<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">page_number = 1\nproduct = db.products.findOne({'slug':'wheel-barrow-9092'})\ncategory = db.categories.findOne({'_id': product['main_cat_id']})\nreviews_count = db.reviews.count({'product_id':product['_id']})\nreviews = db.reviews.find({'product_id':product['_id']})\n                             .skip((page_number - 1) * 12)\n                             .limit(12)\n                             .sort({'helpful_votes':-1})<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\ucd94\ucc9c\uc218\uac00 \ub9ce\uc740 \uc21c\uc11c\ub300\ub85c \uc815\ub82c\ud574\uc11c 12\uac1c\uc758 \ub9ac\ubdf0 \uc870\ud68c<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">page_number = 1\ncategory = db.categories.findOne({'slug':'gardening-tools'})\nsiblings = db.categories.find({'parent_id': category['_id']}) \/\/\uac19\uc740 \ub808\ubca8\uc758 \uce74\ud14c\uace0\ub9ac (\ubd80\ubaa8\uac00 \uac19\uc740)\nproducts = db.products.find({'category_id':category['_id']})\n                              .skip((page_number - 1) * 12)\n                              .limit(12)\n                              .sort({'helpful_votes':-1})<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">db.users.findOne({'username' : 'abc', 'hashed_password' : '....'}) \/\/SELECT *\n\ndb.users.findOne({'username' : 'abc', 'hashed_password' : '....'},{'_id':1})) \/\/ SELECT ID\n\ndb.users.find({'last_name':\/^Ba\/}) \/\/ like 'Ba%' : \uc815\uaddc\ud45c\ud604\uc2dd\uc744 \uc774\uc6a9\ud574 \uc9c8\uc758\n\ndb.users.find({'addresses.zip' : {'$gt':10019, '$lt':10040}) \/\/ $gt : 10019 &lt; , %lt : 10040 &gt;<\/code><\/pre>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">MongoDB \ucffc\ub9ac \uc5b8\uc5b4 \uc0c1\uc138<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\uc9c8\uc758 \uc870\uac74\uacfc \uc140\ub809\ud130<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">db.users.find({'first_name' : 'lee', 'last_name' : 'una'}) \/\/ AND \uc870\uac74 : \ubaa8\ub4e0 \ud14d\uc2a4\ud2b8 \ubb38\uc790\uc5f4 \uc77c\uce58\ub294 \ub300\uc18c\ubb38\uc790 \uad6c\ubd84\n\n\/\/ $gte : 1985 &lt;= , %lte : 2015 &gt;= \ndb.users.find({'birth_year' : {'$gte':1985}, 'birth_year' : {'$lte':2015}) \/\/\uac80\uc0c9\ud0a4\ub97c \ubc18\ubcf5\ud558\ub294 \uac83\uc740 \uc62c\ubc14\ub974\uc9c0 \uc54a\uc74c\ndb.users.find({'birth_year' : {'$gte':1985, '$lte':2015})<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">{\"_id\" : ObjectId(\"...\", \"value\" : 97 }\n{\"_id\" : ObjectId(\"...\", \"value\" : 98 }\n{\"_id\" : ObjectId(\"...\", \"value\" : 99 }\n{\"_id\" : ObjectId(\"...\", \"value\" : \"a\"}\n{\"_id\" : ObjectId(\"...\", \"value\" : \"b\"}\n{\"_id\" : ObjectId(\"...\", \"value\" : \"c\"}\n\ndb.items.find('value' : {'$gte' : 97}) \/\/ =&gt; \uacb0\uacfc\uac12  {\"_id\" : ObjectId(\"...\", \"value\" : 98 } {\"_id\" : ObjectId(\"...\", \"value\" : 99 } \ub9cc \ubc18\ud658 ( \uc81c\uacf5\ub41c \uc870\uac74\uc774 \uc815\uc218\uc774\ubbc0\ub85c \uc815\uc218\uac12\ub9cc \uac00\uc9c4 \ub3c4\ud050\uba3c\ud2b8 \ubc18\ud658)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uac19\uc740 \uceec\ub809\uc158 \ub0b4\uc5d0\uc11c \uac19\uc740 \ud0c0\uc785\uc758 \ub370\uc774\ud130\ub97c \uc800\uc7a5\ud558\ub294 \uc2b5\uad00\uc774 \ud544\uc694<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">{\"_id\" : ObjectId(\"...\", \"value\" : 97 }\n{\"_id\" : ObjectId(\"...\", \"value\" : 98 }\n{\"_id\" : ObjectId(\"...\", \"value\" : 99 }\n\ndb.items.find({'value' : {'$in' : [97,98]}}) \/\/ $in = in, $nin = not in, $or = or\ndb.products.find({'tags':{'$all' : [\"gift\",\"garden\"]}}) \/\/ tags \uceec\ub7fc\uc5d0 gift \uc640 garden \uc774 \ubaa8\ub450 \ud3ec\ud568\ub41c \uc0c1\ud488 \uc870\ud68c<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">$in, $all : \uc778\ub371\uc2a4 \uc0ac\uc6a9<br>$ne, $nin : \uc778\ub371\uc2a4 \uc0ac\uc6a9 \ubabb\ud558\ubbc0\ub85c \uceec\ub809\uc158 \uc2a4\uce94, \uc0ac\uc6a9 \uc2dc \uc778\ub371\uc2a4\ub97c \uc0ac\uc6a9\ud558\ub294 \ub2e4\ub978 \uac80\uc0c9\uc5b4\uc640 \uc870\ud569\ud574\uc11c \uc0ac\uc6a9\ud558\ub294 \uac83\uc774 \uc88b\uc74c<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">$ne : not equal to (!=)<br>$not : $ne\uc740 \uc9c0\uc815\ud55c \uac12\uc774 \uc544\ub2cc \uacbd\uc6b0\ub97c \uc2a4\uce94, \ub2e4\ub978 \uc5f0\uc0b0\uc790\ub098 \uc815\uaddc\ud45c\ud604\uc2dd\uc758 \ucffc\ub9ac\ub97c \uc2a4\uce94\ud558\uace0 \uadf8 \uc5ec\uc9d1\ud569\uc744 \ubc18\ud658<br>$or : \uc81c\uacf5\ub41c \uac80\uc0c9\uc5b4 \uc9d1\ud569 \uc911 \ud558\ub098\ub77c\ub3c4 true\uc77c \uacbd\uc6b0<br>$nor : \uc81c\uacf5\ub41c \uac80\uc0c9\uc5b4 \uc9d1\ud569 \uc911 \ubaa8\ub450 true\uac00 \uc544\ub2d0 \uacbd\uc6b0<br>$and : \uc81c\uacf5\ub41c \uac80\uc0c9\uc5b4 \uc9d1\ud569 \uc911 \ubaa8\ub450 true\uc77c \uacbd\uc6b0<br>$exists : \uc694\uc18c\uac00 \ub3c4\ud050\uba3c\ud2b8 \uc548\uc5d0 \uc874\uc7ac\ud560 \uacbd\uc6b0<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">\/\/ age\uac00 30\ubcf4\ub2e4 \ud070 \ub3c4\ud050\uba3c\ud2b8\ub9cc \ubc18\ud658, $gt\uc640\uc758 \ucc28\uc774\ub294 age \ud544\ub4dc\uac00 \uc5c6\ub294 \ub3c4\ud050\uba3c\ud2b8\ub3c4 \ubc18\ud658\ndb.users.find({'age' : {'$not' : {'$lte' : 30}}})\n\n\/\/\uac19\uc740 \ud0a4\uc5d0\uc11c \uac00\ub2a5\ud55c \uacb0\uacfc\uac12\uc744 \ucc3e\ub294\ub2e4\uba74 $in\ndb.products.find({'details.color':{$in:['blue','Green']}})\n\/\/\ub2e4\ub978 \ud0a4\uc5d0\uc11c \uac00\ub2a5\ud55c \uacb0\uacfc\uac12\uc744 \ucc3e\ub294\ub2e4\uba74 $or\ndb.products.find({'$or': [\n                         {'details.color' : 'blue'},\n                         {'details.manufacturer' : 'Acme'}\n                      ]})<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">\/\/details.color \uc18d\uc131\uc744 \uac00\uc9c4 \uc0c1\ud488 \uc870\ud68c\ndb.products.find({'details.color':{$exists:true}})<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>\uc11c\ube0c\ub3c4\ud050\uba3c\ud2b8 \ub9e4\uce6d<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">{\n  _id : {\n          sym : 'GOOG',\n          date : 20101005\n        },\n        open: 40.23,\n        high: 45.50,\n        low: 38.81,\n        close: 41.22\n}\n\ndb.ticks.find({'_id' : {'sym':'GOOG', 'date':20101005}}) \/\/ 2010\ub144 10\uc6d4 5\uc77c GOOG \uc815\ubcf4 \uc870\ud68c\ndb.ticks.find({'_id' : {'date':20101005,'sym':'GOOG'}}) \/\/\ud574\ub2f9\ucffc\ub9ac\ub294 \uc870\ud68c\ub418\uc9c0 \uc54a\uc74c <\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>\ubc30\uc5f4<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">$elemMatch &#8211; \uc81c\uacf5\ub41c \ubaa8\ub4e0 \uc870\uac74\uc774 \ub3d9\uc77c\ud55c \ud558\uc704 \ub3c4\ud050\uba3c\ud2b8\uc5d0 \uc788\ub294 \uacbd\uc6b0 \uc77c\uce58 (\ub450\uac1c \uc774\uc0c1\uc758 \uc18d\uc131\uc774 \ub9e4\uce58)<br>$size &#8211; \ubc30\uc5f4 \ud558\uc704 \ub3c4\ud050\uba3c\ud2b8\uc758 \ud06c\uae30\uac00 \uc81c\uacf5\ub41c \ub9ac\ud130\ub7f4 \uac12\uacfc \uac19\uc73c\uba74 \uc77c\uce58<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">db.products.find({tags:\"soil\"}) \/\/tags\uac00 \ubc30\uc5f4\uc774\uc5ec\ub3c4 \uc9c8\uc758 \ub3d9\uc77c\n\ndb.products.ensureIndex({tags:1})  \/\/tags \ud544\ub4dc\uc5d0 \uc778\ub371\uc2a4\ub97c \uc774\uc6a9\ud560 \uc218 \uc788\uc74c\ndb.products.find({tags:\"soil'}).explain()\n\ndb.products.find({'tags.0' : \"soil\"}) \/\/\ubc30\uc5f4\uc758 \ud2b9\uc815 \uc704\uce58\uc5d0 \uc788\ub294 \uac12 \uc9c8\uc758 (\uccab\ubc88\uc9f8 \ud0dc\uadf8)\n\ndb.users.find({},{'addresses' : 0, 'payment_methods':0}) \/\/ 0\uc744 \uc0ac\uc6a9\ud558\uba74 \ud574\ub2f9\ud544\ub4dc \ubc30\uc81c<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">{\n   _id : ObjectId(\"...\")\n   username : \"una\",\n   addresses :[\n           {\n              name : \"home\",\n              street : \"588 5th Street\",\n              city : \"Brooklyn\",\n              state : \"NY\".\n              zip : 11215\n           },\n         {\n              name : \"work\",\n              street : \"1 E. 23rd Street\",\n              city : \"New York\",\n              state : \"NY\".\n              zip : 10010\n           },\n}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">db.users.ensureIndex({'addresses.state' : 1}) \/\/\uc778\ub371\uc2a4\uc0dd\uc131\n\ndb.users.find({'addresses.name':'home', 'addresses.state':'NY'})  \/\/\uc704 2\uac1c \ub3c4\ud050\uba3c\ud2b8 \ubc18\ud658\n\/\/\uc5ec\ub7ec \uac1c\uc758 \uc870\uac74\uc744 \ud558\ub098\uc758 \uc11c\ube0c\ub3c4\ud050\uba3c\ud2b8\uc5d0 \ub300\ud574 \uc81c\ud55c\ud560 \ub54c\ndb.users.find({'addresses' : { \n                            '$elemMatch' : {\n                                    'name' : 'home' ,\n                                    'state' : 'NY'\n                                    }\n                   }})<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">db.users.find({'addresses' : {$size:3}}) \/\/addresses \ub0b4 3\uac1c\uc758 \uc8fc\uc18c\ub97c \uac00\uc9c0\uace0 \uc788\ub294 \uc0ac\uc6a9\uc790 \uc870\ud68c<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>\uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \ucffc\ub9ac \uc5f0\uc0b0\uc790<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">$where &#8211; \ub3c4\ud050\uba3c\ud2b8\ub97c \uc120\ud0dd\ud558\uae30 \uc704\ud574 \uc784\uc758\uc758 \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \uc218\ud589<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">db.reviews.find({'$where': \"this.helpfule_votes &gt; 3\"})<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8\ub294 \uc778\ub371\uc2a4\ub97c \uc0ac\uc6a9\ud560 \uc218 \uc5c6\uc73c\uba70 \uc778\ud130\ud504\ub9ac\ud130 \ucf58\ud14d\uc2a4\ud2b8 \uc548\uc5d0\uc11c\ub9cc \uc2e4\ud589\ub418\uace0 \uc2f1\uae00 \uc2a4\ub808\ub4dc\uc774\ubbc0\ub85c \uc624\ubc84\ud5e4\ub4dc\uac00 \ub9ce\uc774 \ubc1c\uc0dd\ub428 =&gt; \ud45c\uc900\ucffc\ub9ac\uc5b8\uc5b4\ub85c \ud45c\ud604\ud560 \uc218 \uc5c6\uc744 \uacbd\uc6b0 \uc0ac\uc6a9<br>\ub610\ud55c \uc778\uc81d\uc158 \uacf5\uaca9\uc5d0\ub3c4 \uc720\uc758\ud574\uc57c\ud568.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>\uc815\uaddc\ud45c\ud604\uc2dd<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">$reges &#8211; \uc694\uc18c\ub97c \uc81c\uacf5\ub41c \uc815\uaddc\ud45c\ud604\uc2dd \ub9e4\uce6d<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">db.reviews.find({'user_id' : ObjectId(\"..\"), 'text' : \/best|worst\/i }) \/\/\ub300\uc18c\ubb38\uc790\ub97c \uad6c\ubd84\ud558\uc9c0 \uc54a\uace0 \uac80\uc0c9 , i \uc0ac\uc6a9 \uc2dc \uc778\ub371\uc2a4 \uc0ac\uc6a9\ubd88\uac00 , \uac80\uc0c9\uc774 \ud544\uc694\ud558\ub2e4\uba74 \uc18c\ubb38\uc790\ubcc0\ud658 \uac80\uc0c9\ud544\ub4dc \ucd94\ucc9c\n\n\n\ndb.reviews.find({'user_id' : ObjectId(\"..\"), 'text' : { '$regex':\"best|worst\", '$options':\"i\" }}) \/\/\uc815\uaddc\ud45c\ud604\uc2dd\uc744 \uc9c0\uc6d0\ud558\uc9c0 \uc54a\ub294 \ud658\uacbd\n\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>\uadf8 \ubc16\uc758 \ucffc\ub9ac \uc5f0\uc0b0\uc790<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">$mod[\ubaab, \uacb0\uacfc] &#8211; \ubaab\uc73c\ub85c \ub098\ub208 \uacb0\uacfc\uac00 \uc694\uc18c\uc640 \uc77c\uce58\ud560 \uacbd\uc6b0<br>$type &#8211; \uc694\uc18c\uc758 \ud0c0\uc785\uc774 \uba85\uc2dc\ub41c BSON \ud0c0\uc785\uacfc \uc77c\uce58\ud560 \uacbd\uc6b0<br>$text &#8211; \ud14d\uc2a4\ud2b8 \uc778\ub371\uc2a4\ub85c \uc778\ub371\uc2f1\ub41c \ud544\ub4dc\uc758 \ub0b4\uc6a9\uc5d0 \ub300\ud574 \ud14d\uc2a4\ud2b8 \uac80\uc0c9 \uc218\ud589<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">\ucffc\ub9ac \uc140\ub809\ud130\uc640 \uc635\uc158<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">projections : \uacb0\uacfc\uac12 \ub3c4\ud050\uba3c\ud2b8\uc5d0 \ubc18\ud658\ud560 \ud544\ub4dc \uc9c0\uc815<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">$slice &#8211; \ubc18\ud658\ub418\ub294 \ub3c4\ud050\uba3c\ud2b8\uc758 \ubd80\ubd84\uc9d1\ud55c\uc744 \uc120\ud0dd<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">db.users.find({}, {'username':1}) \/\/username\ud544\ub4dc\uc640 _id \ud544\ub4dc \ubc18\ud658\n\ndb.users.find({},{'addresses' : 0, 'payment_methods':0}) \/\/ 0\uc744 \uc0ac\uc6a9\ud558\uba74 \ud574\ub2f9\ud544\ub4dc \ubc30\uc81c<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">db.products.find({},{'reviews':{$slice:12}}) \/\/\ucc98\uc74c\ubd80\ud130 12\uac1c\uc758 \ub9ac\ubdf0 \uc870\ud68c\ndb.products.find({},{'reviews':{$slice:-5}}) \/\/\ub9c8\uc9c0\ub9c9\ubd80\ud130 5\uac1c\uc758 \ub9ac\ubdf0 \uc870\ud68c\n\ndb.products.find({},{'reviews':{$slice:[24,12]}) \/\/skip, limit : 24\uac1c\ub97c \uc81c\uc678\ud558\uace0 12\uac1c \uc870\ud68c\ndb.products.find({},{'reviews':{$slice:[24,12]}, 'reviews.rating': 1}) \/\/\ub9ac\ubdf0\ud3c9\uc810\uc774 1\uc778 \ub9ac\ubdf0\ub97c 24\uac1c\ub97c \uc81c\uc678\ud558\uace0 12\uac1c \uc870\ud68c<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">db.reviews.find({}).sort({'rating':-1}) \/\/ \ub0b4\ub9bc\ucc28\uc21c \uc815\ub82c (\ub192\uc74c -&gt; \ub0ae\uc74c) DESC\ndb.reviews.find({}).sort({'helpful_votes': -1, 'rating': -1}) \/\/ helpful_votes DESC, rating DESC \uc21c\uc11c\ub300\ub85c \ub8e8\ube44\ud574\uc2dc\ub294 \ud0dc\uadf8 \uc774\uc6a9 @rivews~<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">db.products.find({}).skip(500000).limit(10).sort({date:-1}) \/\/skip\uac12\uc774 \ucee4\uc9c0\uba74 \ube44\ud6a8\uc728\uc801\uc784\n\n\/\/skip\uc744 \uc0dd\ub7b5\ud558\uace0 \ub300\uc2e0 \ucffc\ub9ac\uc5d0 \ub2e4\uc74c \uacb0\uacfc\uac12\uc774 \uc2dc\uc791\ub418\ub294 \ubc94\uc704 \uc870\uac74\uc744 \ucd94\uac00\ud558\ub294 \ubc29\uc2dd\uc73c\ub85c \uc218\uc815\nprevious_page_date = new Date(2013, 05, 05)\ndb.products.find({'date': {'$gt':previous_page_date}}).limit(10).sort({'date':-1})<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\ucffc\ub9ac \uc791\uc131\ud558\uae30 \ub2e4\ub978 \ud234\uacfc \ub2e4\ub978 \uc810\uc740 \ucffc\ub9ac \uc5b8\uc5b4\uc5d0 \uc788\ub2e4. SQL\uacfc \uac19\uc774 \ud45c\uc900\ud654\ub41c \ucffc\ub9ac \uc5b8\uc5b4\ub97c \uc0ac\uc6a9\ud558\ub294 \uac83 \ub300\uc2e0\uc5d0 \uc790\ubc14\uc2a4\ud06c\ub9bd\ud2b8 \ud504\ub85c\uadf8\ub798\ubc0d \uc5b8\uc5b4\uc640 \uac04\ub2e8\ud55c API\ub97c \uc0ac\uc6a9\ud574 \uc11c\ubc84\uc640 \uc5f0\uacb0\ud55c\ub2e4. \uc804\uc790\uc0c1\uac70\ub798 \ub370\uc774\ud130 \ubaa8\ub378 \uc9c8\uc758 findOne Vs find \ucffc\ub9ac findOne : \ub3c4\ud050\uba3c\ud2b8 \ubc18\ud658 (= db.products.find({&#8216;slug&#8217;:&#8217;wheel-barrow-9092&#8242;}).limit(1))find : \ucee4\uc11c \uac1d\uccb4 \ubc18\ud658 =&gt; \uc5ec\ub7ec \uac1c\uc758 \uacb0\uacfc \ub3c4\ud050\uba3c\ud2b8\uac00 \ud544\uc694\ud558\ub2e4\uba74 find \uc0ac\uc6a9 skip, limit \uadf8\ub9ac\uace0 \ucffc\ub9ac &#8230; <a title=\"\ubabd\uace0\ub514\ube44 \uc778 \uc561\uc158 5\uc7a5\" class=\"read-more\" href=\"https:\/\/scrutineer.co.kr\/wordpress\/index.php\/2021\/10\/21\/%eb%aa%bd%ea%b3%a0%eb%94%94%eb%b9%84-%ec%9d%b8-%ec%95%a1%ec%85%98-5%ec%9e%a5\/\" aria-label=\"Read more about \ubabd\uace0\ub514\ube44 \uc778 \uc561\uc158 5\uc7a5\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-718","post","type-post","status-publish","format-standard","hentry","category-4"],"_links":{"self":[{"href":"https:\/\/scrutineer.co.kr\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/718","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scrutineer.co.kr\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scrutineer.co.kr\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scrutineer.co.kr\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/scrutineer.co.kr\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=718"}],"version-history":[{"count":13,"href":"https:\/\/scrutineer.co.kr\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/718\/revisions"}],"predecessor-version":[{"id":764,"href":"https:\/\/scrutineer.co.kr\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/718\/revisions\/764"}],"wp:attachment":[{"href":"https:\/\/scrutineer.co.kr\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=718"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scrutineer.co.kr\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=718"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scrutineer.co.kr\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=718"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}