{"id":68490,"date":"2024-07-07T15:51:40","date_gmt":"2024-07-07T12:21:40","guid":{"rendered":"https:\/\/nabfollower.com\/blog\/crud-in-firebase-5hk3\/"},"modified":"2024-07-07T15:51:40","modified_gmt":"2024-07-07T12:21:40","slug":"crud-in-firebase-5hk3","status":"publish","type":"post","link":"https:\/\/nabfollower.com\/blog\/crud-in-firebase-5hk3\/","title":{"rendered":"CRUD \u062f\u0631 Firebase &#8211; \u0627\u0646\u062c\u0645\u0646 DEV"},"content":{"rendered":"<p>Summarize this content to 400 words in Persian Lang<br \/>\n            \u0639\u0645\u0644\u06cc\u0627\u062a CRUD \u062f\u0631 Firebase \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 react \u0648 javascript<\/p>\n<p>        \/\/ Read<br \/>\n        db.collection(&#8216;products&#8217;).get().then(resposne=&gt;{<br \/>\n          resposne.forEach((object)=&gt;{<br \/>\n            console.log(object.data(),object.id);<br \/>\n          })<br \/>\n        })<\/p>\n<p>        \/\/ Create<br \/>\n        db.collection(&#8216;products&#8217;).add({<br \/>\n          name: &#8216;Laptop&#8217;,<br \/>\n          type: &#8216;Electronics&#8217;,<br \/>\n          price: 50000<br \/>\n        }).then(()=&gt;{<br \/>\n          console.log(&#8216;Added&#8217;);<br \/>\n        })<\/p>\n<p>        \/\/ Delete<br \/>\n        db.collection(&#8216;products&#8217;).doc(&#8216;Q4tjiYSC05MjYG6pQBIQ&#8217;).delete().then(()=&gt;{<br \/>\n          console.log(&#8216;Deleted&#8217;);<br \/>\n        })<\/p>\n<p>        \/\/ Update<br \/>\n        db.collection(&#8216;products&#8217;).doc(&#8216;BDgu0r6ECRtyUKxxkxcs&#8217;).update({<br \/>\n          name: &#8216;Laptop&#8217;,<br \/>\n          type: &#8216;Electronics&#8217;,<br \/>\n          price: 50<br \/>\n        }).then(()=&gt;{<br \/>\n          console.log(&#8216;Updated&#8217;);<br \/>\n        })<\/p>\n<p>    \u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/p>\n<p>    \u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/p>\n<div data-article-id=\"1914488\" id=\"article-body\">\n<p>\u0639\u0645\u0644\u06cc\u0627\u062a CRUD \u062f\u0631 Firebase \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 react \u0648 javascript<\/p>\n<div class=\"highlight js-code-highlight\">\n<pre class=\"highlight plaintext\"><code>\n        \/\/ Read\n        db.collection('products').get().then(resposne=&gt;{\n          resposne.forEach((object)=&gt;{\n            console.log(object.data(),object.id);\n          })\n        })\n\n        \/\/ Create\n        db.collection('products').add({\n          name: 'Laptop',\n          type: 'Electronics',\n          price: 50000\n        }).then(()=&gt;{\n          console.log('Added');\n        })\n\n        \/\/ Delete\n        db.collection('products').doc('Q4tjiYSC05MjYG6pQBIQ').delete().then(()=&gt;{\n          console.log('Deleted');\n        })\n\n        \/\/ Update\n        db.collection('products').doc('BDgu0r6ECRtyUKxxkxcs').update({\n          name: 'Laptop',\n          type: 'Electronics',\n          price: 50\n        }).then(()=&gt;{\n          console.log('Updated');\n        })\n\n<\/code><\/pre>\n<div class=\"highlight__panel js-actions-panel\">\n<div class=\"highlight__panel-action js-fullscreen-code-action\">\n    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-on\"><title>\u0648\u0627\u0631\u062f \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M16 3h6v6h-2V5h-4V3zM2 3h6v2H4v4H2V3zm18 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z\"\/>\n<\/svg><\/p>\n<p>    <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" class=\"highlight-action crayons-icon highlight-action--fullscreen-off\"><title>\u0627\u0632 \u062d\u0627\u0644\u062a \u062a\u0645\u0627\u0645 \u0635\u0641\u062d\u0647 \u062e\u0627\u0631\u062c \u0634\u0648\u06cc\u062f<\/title>\n    <path d=\"M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z\"\/>\n<\/svg><\/p>\n<\/div>\n<\/div>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Summarize this content to 400 words in Persian Lang \u0639\u0645\u0644\u06cc\u0627\u062a CRUD \u062f\u0631 Firebase \u0628\u0627 \u0627\u0633\u062a\u0641\u0627\u062f\u0647 \u0627\u0632 react \u0648 javascript \/\/ Read db.collection(&#8216;products&#8217;).get().then(resposne=&gt;{ resposne.forEach((object)=&gt;{ console.log(object.data(),object.id); }) }) \/\/ Create db.collection(&#8216;products&#8217;).add({ name: &#8216;Laptop&#8217;, type: &#8216;Electronics&#8217;, price: 50000 }).then(()=&gt;{ console.log(&#8216;Added&#8217;); }) \/\/ Delete db.collection(&#8216;products&#8217;).doc(&#8216;Q4tjiYSC05MjYG6pQBIQ&#8217;).delete().then(()=&gt;{ console.log(&#8216;Deleted&#8217;); }) \/\/ Update db.collection(&#8216;products&#8217;).doc(&#8216;BDgu0r6ECRtyUKxxkxcs&#8217;).update({ name: &#8216;Laptop&#8217;, type: &#8216;Electronics&#8217;, price: 50 }).then(()=&gt;{ console.log(&#8216;Updated&#8217;); }) &hellip;<\/p>\n","protected":false},"author":2,"featured_media":68491,"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-68490","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\/68490","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=68490"}],"version-history":[{"count":0,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/posts\/68490\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media\/68491"}],"wp:attachment":[{"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/media?parent=68490"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/categories?post=68490"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nabfollower.com\/blog\/wp-json\/wp\/v2\/tags?post=68490"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}