{"id":82164,"date":"2024-11-01T07:36:34","date_gmt":"2024-11-01T04:06:34","guid":{"rendered":"https:\/\/nabfollower.com\/blog\/codes-on-20hp\/"},"modified":"2024-11-01T07:36:34","modified_gmt":"2024-11-01T04:06:34","slug":"codes-on-20hp","status":"publish","type":"post","link":"https:\/\/nabfollower.com\/blog\/codes-on-20hp\/","title":{"rendered":"\u06a9\u062f\u0647\u0627 \u0631\u0648\u0634\u0646 \u0627\u0633\u062a"},"content":{"rendered":"<p>Summarize this content to 400 words in Persian Lang \u0645\u062c\u0627\u0632\u06cc<\/p>\n<p>const mongoose = need(&#39;mongoose&#39;);<br \/>\nconst Schema = mongoose.schema;<\/p>\n<p>const userSchema = new Schema({<br \/>\n  \u0646\u0627\u0645: \u0631\u0634\u062a\u0647\u060c<br \/>\n  \u0646\u0627\u0645 \u062e\u0627\u0646\u0648\u0627\u062f\u06af\u06cc: \u0631\u0634\u062a\u0647\u060c<br \/>\n})\u061b<\/p>\n<p>\/\/ \u06cc\u06a9 \u0645\u062c\u0627\u0632\u06cc \u0628\u0631\u0627\u06cc \u0646\u0627\u0645 \u06a9\u0627\u0645\u0644 \u06a9\u0627\u0631\u0628\u0631 \u062a\u0639\u0631\u06cc\u0641 \u06a9\u0646\u06cc\u062f<br \/>\nuserSchema.virtual(&#39;fullName&#39;).get(function() {<br \/>\n  \u0628\u0627\u0632\u06af\u0634\u062a ${this.firstName} ${this.lastName};<br \/>\n})\u061b<\/p>\n<p>const User = mongoose.model(&#39;User&#39;, userSchema);<\/p>\n<p>\/\/ \u0627\u0633\u062a\u0641\u0627\u062f\u0647<br \/>\nconst user = \u06a9\u0627\u0631\u0628\u0631 \u062c\u062f\u06cc\u062f({ firstName: &#39;John&#39;, lastName: &#39;Doe&#39; });<br \/>\nconsole.log(user.fullName); \/\/ \u062e\u0631\u0648\u062c\u06cc: &#8220;John Doe&#8221;<\/p>\n<p>\u062c\u0645\u0639\u06cc\u062a<br \/>\nconst postSchema = \u0637\u0631\u062d\u0648\u0627\u0631\u0647 \u062c\u062f\u06cc\u062f({<br \/>\n  \u0639\u0646\u0648\u0627\u0646: \u0631\u0634\u062a\u0647\u060c<br \/>\n  \u0645\u062d\u062a\u0648\u0627: \u0631\u0634\u062a\u0647\u060c<br \/>\n  \u0646\u0648\u06cc\u0633\u0646\u062f\u0647: { type: Schema.Types.ObjectId\u060c ref: &#39;User&#39; }<br \/>\n})\u061b<\/p>\n<p>const Post = mongoose.model(&#39;Post&#39;, postSchema);<\/p>\n<p>\/\/ \u067e\u0631 \u06a9\u0631\u062f\u0646 author \u0647\u0646\u06af\u0627\u0645 \u067e\u0631\u0633 \u0648 \u062c\u0648 \u0627\u0632 \u067e\u0633\u062a \u0647\u0627<br \/>\nPost.find()<br \/>\n  .populate(&#39;author&#39;) \/\/ \u0633\u0646\u062f \u06a9\u0627\u0631\u0628\u0631 \u0645\u0631\u062a\u0628\u0637 \u0631\u0627 \u0648\u0627\u06a9\u0634\u06cc \u0645\u06cc \u06a9\u0646\u062f<br \/>\n  .exec((\u062e\u0637\u0627\u060c \u067e\u0633\u062a \u0647\u0627) => {<br \/>\n    console.log(posts);<br \/>\n  })\u061b<\/p>\n<p>\u0646\u0645\u0627\u06cc\u0647 \u0633\u0627\u0632\u06cc<br \/>\nconst productSchema = new Schema({<br \/>\n  \u0646\u0627\u0645: \u0631\u0634\u062a\u0647\u060c<br \/>\n  \u0642\u06cc\u0645\u062a: \u062a\u0639\u062f\u0627\u062f<br \/>\n  \u062f\u0633\u062a\u0647 \u0628\u0646\u062f\u06cc: \u0631\u0634\u062a\u0647<br \/>\n})\u061b<\/p>\n<p>\/\/ \u0627\u06cc\u062c\u0627\u062f \u06cc\u06a9 \u0634\u0627\u062e\u0635 \u062f\u0631 category \u0632\u0645\u06cc\u0646\u0647<br \/>\nproductSchema.index({ \u062f\u0633\u062a\u0647: 1 });<\/p>\n<p>const Product = mongoose.model(&#39;Product&#39;, productSchema);<\/p>\n<p>\/\/ \u0627\u06a9\u0646\u0648\u0646\u060c \u067e\u0631\u0633 \u0648 \u062c\u0648\u0647\u0627 \u0631\u0648\u0634\u0646 \u0627\u0633\u062a category \u0633\u0631\u06cc\u0639\u062a\u0631 \u062e\u0648\u0627\u0647\u062f \u0628\u0648\u062f<br \/>\nProduct.find({ category: &#39;Electronic&#39; }, (err, products) => {<br \/>\n  console.log(products);<br \/>\n})\u061b<\/p>\n<p>\u0645\u062c\u0627\u0632\u06cc<\/p>\n<p>const mongoose = need(&#39;mongoose&#39;);<br \/>\nconst Schema = mongoose.schema;<\/p>\n<p>const userSchema = new Schema({<br \/>\n  \u0646\u0627\u0645: \u0631\u0634\u062a\u0647\u060c<br \/>\n  \u0646\u0627\u0645 \u062e\u0627\u0646\u0648\u0627\u062f\u06af\u06cc: \u0631\u0634\u062a\u0647\u060c<br \/>\n})\u061b<\/p>\n<p>\/\/ \u06cc\u06a9 \u0645\u062c\u0627\u0632\u06cc \u0628\u0631\u0627\u06cc \u0646\u0627\u0645 \u06a9\u0627\u0645\u0644 \u06a9\u0627\u0631\u0628\u0631 \u062a\u0639\u0631\u06cc\u0641 \u06a9\u0646\u06cc\u062f<br \/>\nuserSchema.virtual(&#39;fullName&#39;).get(function() {<br \/>\n  \u0628\u0627\u0632\u06af\u0634\u062a <code>${this.firstName} ${this.lastName}<\/code>;<br \/>\n})\u061b<\/p>\n<p>const User = mongoose.model(&#39;User&#39;, userSchema);<\/p>\n<p>\/\/ \u0627\u0633\u062a\u0641\u0627\u062f\u0647<br \/>\nconst user = \u06a9\u0627\u0631\u0628\u0631 \u062c\u062f\u06cc\u062f({ firstName: &#39;John&#39;, lastName: &#39;Doe&#39; });<br \/>\nconsole.log(user.fullName); \/\/ \u062e\u0631\u0648\u062c\u06cc: &#8220;John Doe&#8221;<\/p>\n<p>\u062c\u0645\u0639\u06cc\u062a<br \/>\nconst postSchema = \u0637\u0631\u062d\u0648\u0627\u0631\u0647 \u062c\u062f\u06cc\u062f({<br \/>\n  \u0639\u0646\u0648\u0627\u0646: \u0631\u0634\u062a\u0647\u060c<br \/>\n  \u0645\u062d\u062a\u0648\u0627: \u0631\u0634\u062a\u0647\u060c<br \/>\n  \u0646\u0648\u06cc\u0633\u0646\u062f\u0647: { type: Schema.Types.ObjectId\u060c ref: &#39;User&#39; }<br \/>\n})\u061b<\/p>\n<p>const Post = mongoose.model(&#39;Post&#39;, postSchema);<\/p>\n<p>\/\/ \u067e\u0631 \u06a9\u0631\u062f\u0646 <code>author<\/code> \u0647\u0646\u06af\u0627\u0645 \u067e\u0631\u0633 \u0648 \u062c\u0648 \u0627\u0632 \u067e\u0633\u062a \u0647\u0627<br \/>\nPost.find()<br \/>\n  .populate(&#39;author&#39;) \/\/ \u0633\u0646\u062f \u06a9\u0627\u0631\u0628\u0631 \u0645\u0631\u062a\u0628\u0637 \u0631\u0627 \u0648\u0627\u06a9\u0634\u06cc \u0645\u06cc \u06a9\u0646\u062f<br \/>\n  .exec((\u062e\u0637\u0627\u060c \u067e\u0633\u062a \u0647\u0627) => {<br \/>\n    console.log(posts);<br \/>\n  })\u061b<\/p>\n<p>\u0646\u0645\u0627\u06cc\u0647 \u0633\u0627\u0632\u06cc<br \/>\nconst productSchema = new Schema({<br \/>\n  \u0646\u0627\u0645: \u0631\u0634\u062a\u0647\u060c<br \/>\n  \u0642\u06cc\u0645\u062a: \u062a\u0639\u062f\u0627\u062f<br \/>\n  \u062f\u0633\u062a\u0647 \u0628\u0646\u062f\u06cc: \u0631\u0634\u062a\u0647<br \/>\n})\u061b<\/p>\n<p>\/\/ \u0627\u06cc\u062c\u0627\u062f \u06cc\u06a9 \u0634\u0627\u062e\u0635 \u062f\u0631 <code>category<\/code> \u0632\u0645\u06cc\u0646\u0647<br \/>\nproductSchema.index({ \u062f\u0633\u062a\u0647: 1 });<\/p>\n<p>const Product = mongoose.model(&#39;Product&#39;, productSchema);<\/p>\n<p>\/\/ \u0627\u06a9\u0646\u0648\u0646\u060c \u067e\u0631\u0633 \u0648 \u062c\u0648\u0647\u0627 \u0631\u0648\u0634\u0646 \u0627\u0633\u062a <code>category<\/code> \u0633\u0631\u06cc\u0639\u062a\u0631 \u062e\u0648\u0627\u0647\u062f \u0628\u0648\u062f<br \/>\nProduct.find({ category: &#39;Electronic&#39; }, (err, products) => {<br \/>\n  console.log(products);<br \/>\n})\u061b<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summarize this content to 400 words in Persian Lang \u0645\u062c\u0627\u0632\u06cc const mongoose = need(&#39;mongoose&#39;); const Schema = mongoose.schema; const userSchema = new Schema({ \u0646\u0627\u0645: \u0631\u0634\u062a\u0647\u060c \u0646\u0627\u0645 \u062e\u0627\u0646\u0648\u0627\u062f\u06af\u06cc: \u0631\u0634\u062a\u0647\u060c })\u061b \/\/ \u06cc\u06a9 \u0645\u062c\u0627\u0632\u06cc \u0628\u0631\u0627\u06cc \u0646\u0627\u0645 \u06a9\u0627\u0645\u0644 \u06a9\u0627\u0631\u0628\u0631 \u062a\u0639\u0631\u06cc\u0641 \u06a9\u0646\u06cc\u062f userSchema.virtual(&#39;fullName&#39;).get(function() { \u0628\u0627\u0632\u06af\u0634\u062a ${this.firstName} ${this.lastName}; })\u061b const User = mongoose.model(&#39;User&#39;, userSchema); \/\/ \u0627\u0633\u062a\u0641\u0627\u062f\u0647 const user = \u06a9\u0627\u0631\u0628\u0631 &hellip;<\/p>\n","protected":false},"author":2,"featured_media":82165,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"","fifu_image_alt":"","footnotes":""},"categories":[339],"tags":[],"class_list":["post-82164","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dev"],"_links":{"self":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/82164","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/comments?post=82164"}],"version-history":[{"count":0,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/82164\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media\/82165"}],"wp:attachment":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media?parent=82164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/categories?post=82164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/tags?post=82164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}