{"id":112052,"date":"2021-11-17T07:00:00","date_gmt":"2021-11-17T05:00:00","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=112052"},"modified":"2021-11-15T15:17:41","modified_gmt":"2021-11-15T13:17:41","slug":"firebase-cloud-firestore-using-node-js","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/firebase-cloud-firestore-using-node-js.html","title":{"rendered":"Firebase Cloud Firestore using Node.js"},"content":{"rendered":"<p>Hello. In this tutorial, we will explain the implementation of Firebase Firestore in the node.js application. The application will be responsible to perform the crud operations.<\/p>\n<h2>1. Introduction<\/h2>\n<p>Firebase is a <em>Backend-as-a-Service<\/em> (BaaS) that helps to store real-time data in the database. Allows syncing the real-time data across all devices. Features &#8211;<\/p>\n<ul>\n<li>Serverless<\/li>\n<li>Highly secure<\/li>\n<li>Offers minimal setup<\/li>\n<li>Provides three-way binding via angular fire<\/li>\n<li>Easily access data, authentication, and more<\/li>\n<li>Offers JSON storage that means no barrier between data and objects<\/li>\n<li>Has a good storage potential<\/li>\n<\/ul>\n<p>Just like any other storage solution firebase also have some advantages i.e.<\/p>\n<ul>\n<li>Limited querying and indexing support<\/li>\n<li>No support for aggregation and map-reduce functionality<\/li>\n<\/ul>\n<h3>1.1 Setting up Node.js<\/h3>\n<p>To set up <strong>Node.js<\/strong> on windows you will need to download the installer from <a href=\"https:\/\/nodejs.org\/en\/download\/\" target=\"_blank\" rel=\"noopener\">this<\/a> link. Click on the installer (also include the NPM package manager) for your platform and run the installer to start with the Node.js setup wizard. Follow the wizard steps and click on Finish when it is done. If everything goes well you can navigate to the command prompt to verify if the installation was successful as shown in Fig. 1.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2021\/11\/node-npm-installation-img1.jpg\"><img decoding=\"async\" width=\"480\" height=\"91\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2021\/11\/node-npm-installation-img1.jpg\" alt=\"Firebase Firestore in node.js - verifying npm installation\" class=\"wp-image-112053\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2021\/11\/node-npm-installation-img1.jpg 480w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2021\/11\/node-npm-installation-img1-300x57.jpg 300w\" sizes=\"(max-width: 480px) 100vw, 480px\" \/><\/a><figcaption>Fig. 1: Verifying node and npm installation<\/figcaption><\/figure>\n<\/div>\n<h2>2. Firebase Cloud Firestore using Node.js<\/h2>\n<p>To set up the application, we will need to navigate to a path where our project will reside. For programming stuff, I am using <a href=\"https:\/\/code.visualstudio.com\/\" target=\"_blank\" rel=\"noopener\">Visual Studio Code<\/a> as my preferred IDE. You&#8217;re free to choose the IDE of your choice.<\/p>\n<h3>2.1 Setting up the Firebase project<\/h3>\n<p>To set up the project implementation we will need a firebase project with the real-time database enabled. Once the project is created copy the firebase configuration which will be used in the <code>.env<\/code> properties. Refer to <a href=\"#section222\">Section 2.2.2<\/a> for details. You can take a look at <a href=\"https:\/\/www.youtube.com\/watch?v=6juww5Lmvgo&amp;ab_channel=GoogleAnalytics\" target=\"_blank\" rel=\"noopener\">this<\/a> link to quickly create a firebase project in the google console.<\/p>\n<h3>2.2 Setting up the implementation<\/h3>\n<p>Let us write the different files which will be required for practical learning.<\/p>\n<h4>2.2.1 Setting up dependencies<\/h4>\n<p>Navigate to the project directory and run <code>npm init -y<\/code> to create a <code>package.json<\/code> file. This <a href=\"https:\/\/docs.npmjs.com\/creating-a-package-json-file\" target=\"_blank\" rel=\"noopener\">file<\/a> holds the metadata relevant to the project and is used for managing the project dependencies, script, version, etc. Add the following code to the file wherein we will specify the required dependencies.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>package.json<\/em><\/span><\/p>\n<pre class=\"brush:json;\">{\n  \"name\": \"node-firebase\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" &amp;&amp; exit 1\",\n    \"start\": \"nodemon index.js\"\n  },\n  \"keywords\": [],\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"body-parser\": \"^1.19.0\",\n    \"cors\": \"^2.8.5\",\n    \"dotenv\": \"^10.0.0\",\n    \"express\": \"^4.17.1\",\n    \"firebase\": \"^8.0.1\"\n  },\n  \"devDependencies\": {\n    \"nodemon\": \"^2.0.15\"\n  }\n}\n<\/pre>\n<p>To download the dependencies navigate to the directory path containing the file and use the <code>npm install<\/code> command. If everything goes well the dependencies will be loaded inside the <code>node_modules<\/code> folder and you are good to go with the further steps.<\/p>\n<h4><a name=\"section222\"><\/a>2.2.2 Creating an environment file<\/h4>\n<p>Add the following code to the environment file. The file will be responsible to have the configuration variables spread across the application for further use.<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p><span style=\"text-decoration: underline;\"><em>.env<\/em><\/span><\/p>\n<pre class=\"brush:plain;\">#express server configuration\nPORT=3000\nHOST=localhost\nHOST_URL=http:\/\/localhost:3001\n\n#firebase configuration\nAPI_KEY=your_api_key\nAUTH_DOMAIN=app_auth_domain\nDATABASE_URL=app_realtime_database_url\nPROJECT_ID=app_id\nSTORAGE_BUCKET=app_storage_bucket\nMESSAGING_SENDER_ID=messaging_sender_id\nAPP_ID=app_id\n<\/pre>\n<h4>2.2.3 Creating configuration file<\/h4>\n<p>Add the following code to the configuration file. The file will be responsible to import the environment variables from the <code>.env<\/code> file and perform the initialization assertions. The assertions to helps to avoid the common failures post the application startup.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>config.js<\/em><\/span><\/p>\n<pre class=\"brush:js;\">const dotenv = require(\"dotenv\");\nconst assert = require(\"assert\");\n\ndotenv.config();\n\nconst {\n  PORT,\n  HOST,\n  HOST_URL,\n  API_KEY,\n  AUTH_DOMAIN,\n  DATABASE_URL,\n  PROJECT_ID,\n  STORAGE_BUCKET,\n  MESSAGING_SENDER_ID,\n  APP_ID\n} = process.env;\n\n\/\/ adding init assertions\nassert(PORT, \"Application port is required\");\nassert(HOST_URL, \"Service endpoint is required\");\nassert(DATABASE_URL, \"Firebase database endpoint is required\");\nassert(PROJECT_ID, \"Firebase project id is required\");\nassert(APP_ID, \"Firebase app id is required\");\n\nmodule.exports = {\n  port: PORT,\n  host: HOST,\n  url: HOST_URL,\n  firebaseConfig: {\n    apiKey: API_KEY,\n    authDomain: AUTH_DOMAIN,\n    databaseURL: DATABASE_URL,\n    projectId: PROJECT_ID,\n    storageBucket: STORAGE_BUCKET,\n    messagingSenderId: MESSAGING_SENDER_ID,\n    appId: APP_ID\n  }\n};\n<\/pre>\n<h4>2.2.4 Creating database configuration<\/h4>\n<p>Add the following code to the database configuration file. The file will be responsible to initialize the Firebase configuration required for this application.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>db.js<\/em><\/span><\/p>\n<pre class=\"brush:js;\">const firebase = require(\"firebase\");\nconst config = require(\".\/config\");\n\nconst db = firebase.initializeApp(config.firebaseConfig);\n\nmodule.exports = db;\n<\/pre>\n<h4>2.2.5 Creating a model class<\/h4>\n<p>Add the following code to the model class which will be responsible to map the data to\/from the Firebase Firestore collection.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>employee.js<\/em><\/span><\/p>\n<pre class=\"brush:js;\">class Employee {\n  constructor(id, fullName, age, contact, department) {\n    this.id = id; \/\/ represents the id generated by the firestore\n    this.fullName = fullName;\n    this.age = age;\n    this.contact = contact;\n    this.department = department;\n  }\n}\n\nmodule.exports = Employee;\n<\/pre>\n<h4>2.2.6 Creating a controller class<\/h4>\n<p>Add the following code to the controller class which will be responsible to get the data from the client and interact with the Firebase Firestore collection. The class consists of different methods to save a new employee, update\/delete\/get an employee by id, and get all employees.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>employeeController.js<\/em><\/span><\/p>\n<pre class=\"brush:js;\">const firebase = require(\"..\/db\");\nconst Employee = require(\"..\/models\/employee\");\nconst fireStore = firebase.firestore();\n\n\/\/ performing crud operations in the firebase firestore\n\/\/ add\n\/\/ get all\n\/\/ get\n\/\/ update\n\/\/ delete\n\nconst addEmployee = async (req, res, next) =&gt; {\n  try {\n    console.log(\"Adding new employee\");\n    const data = req.body;\n    await fireStore.collection(\"employees\").doc().set(data);\n    res.status(201).json({ message: \"Record saved successfully\" });\n  } catch (error) {\n    res.status(400).json({ message: error.message });\n  }\n};\n\nconst getAllEmployees = async (req, res, next) =&gt; {\n  try {\n    console.log(\"Getting all employees\");\n    const employees = await fireStore.collection(\"employees\");\n    const data = await employees.get();\n    const arr = [];\n    if (data.empty) {\n      res.status(200).json({ message: \"No records found\" });\n    } else {\n      let total = 0;\n      data.forEach((item) =&gt; {\n        const employee = new Employee(\n          item.id,\n          item.data().fullName,\n          item.data().age,\n          item.data().contact,\n          item.data().department\n        );\n        arr.push(employee);\n        total = total + 1;\n      });\n      res.status(200).json({\n        listing: arr,\n        count: total\n      });\n    }\n  } catch (error) {\n    res.status(400).json({ message: error.message });\n  }\n};\n\nconst getEmployee = async (req, res, next) =&gt; {\n  try {\n    const id = req.params.id;\n    console.log(\"Getting employee= %s\", id);\n    const employee = await fireStore.collection(\"employees\").doc(id);\n    const data = await employee.get();\n    if (!data.exists) {\n      res.status(404).json({ message: \"Record not found\" });\n    } else {\n      res.status(200).json(data.data());\n    }\n  } catch (error) {\n    res.status(400).json({ message: error.message });\n  }\n};\n\nconst updateEmployee = async (req, res, next) =&gt; {\n  try {\n    const id = req.params.id;\n    console.log(\"Updating employee= %s\", id);\n    const data = req.body;\n    const employee = await fireStore.collection(\"employees\").doc(id);\n    await employee.update(data);\n    res.status(204).json({ message: \"Record updated successfully\" });\n  } catch (error) {\n    res.status(400).json({ message: error.message });\n  }\n};\n\nconst deleteEmployee = async (req, res, next) =&gt; {\n  try {\n    const id = req.params.id;\n    console.log(\"Deleting employee= %s\", id);\n    await fireStore.collection(\"employees\").doc(id).delete();\n    res.status(204).json({ message: \"Record deleted successfully\" });\n  } catch (error) {\n    res.status(400).json({ message: error.message });\n  }\n};\n\n\/\/ todo - add delete all employees\n\nmodule.exports = {\n  addEmployee,\n  getAllEmployees,\n  getEmployee,\n  updateEmployee,\n  deleteEmployee\n};\n<\/pre>\n<h4>2.2.7 Creating a router class<\/h4>\n<p>Add the following code to the router class which will be responsible to map the incoming request from the client with the appropriate controller method.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>employeeController.js<\/em><\/span><\/p>\n<pre class=\"brush:js;\">const express = require(\"express\");\nconst {\n  addEmployee,\n  getAllEmployees,\n  getEmployee,\n  updateEmployee,\n  deleteEmployee\n} = require(\"..\/controllers\/employeeController\");\n\nconst router = express.Router();\n\n\/\/ http:\/\/localhost:3000\/api\/employee\nrouter.post(\"\/employee\", addEmployee);\n\n\/\/ http:\/\/localhost:3000\/api\/employees\nrouter.get(\"\/employees\", getAllEmployees);\n\n\/\/ http:\/\/localhost:3000\/api\/employee\/xxxx_employee_id\nrouter.get(\"\/employee\/:id\", getEmployee);\n\n\/\/ http:\/\/localhost:3000\/api\/employee\/xxxx_employee_id\nrouter.put(\"\/employee\/:id\", updateEmployee);\n\n\/\/ http:\/\/localhost:3000\/api\/employee\/xxxx_employee_id\nrouter.delete(\"\/employee\/:id\", deleteEmployee);\n\nmodule.exports = {\n  routes: router\n};\n<\/pre>\n<h4>2.2.8 Creating an index file<\/h4>\n<p>Add the following code to the index file which will be responsible for the application startup and act as a welcome point for the application.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>index.js<\/em><\/span><\/p>\n<pre class=\"brush:js;\">const express = require(\"express\");\nconst cors = require(\"cors\");\nconst bodyParser = require(\"body-parser\");\nconst config = require(\".\/config\");\nconst employeeRoutes = require(\".\/routes\/employeeRoutes\");\n\nconst app = express();\n\napp.use(express.json());\napp.use(cors());\napp.use(bodyParser.json());\n\napp.use(\"\/api\", employeeRoutes.routes);\n\napp.listen(config.port, () =&gt; {\n  console.log(\"Service endpoint= %s\", config.url);\n});\n<\/pre>\n<h2>3. Run the Application<\/h2>\n<p>To run the application navigate to the project directory and enter the following command as shown in Fig. 2. If everything goes well the application will be started successfully on a port number read from the <code>.env<\/code> file. In this case, the application will be started successfully on a port number \u2013 <code>3001<\/code>.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><a href=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2021\/11\/project-run-guide.jpg\"><img decoding=\"async\" width=\"588\" height=\"128\" src=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2021\/11\/project-run-guide.jpg\" alt=\"\" class=\"wp-image-112054\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2021\/11\/project-run-guide.jpg 588w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2021\/11\/project-run-guide-300x65.jpg 300w\" sizes=\"(max-width: 588px) 100vw, 588px\" \/><\/a><figcaption>Fig. 2: Starting the application<\/figcaption><\/figure>\n<\/div>\n<h2>4. Demo<\/h2>\n<p>You are free to use <a href=\"https:\/\/www.getpostman.com\/\" target=\"_blank\" rel=\"noopener\">postman<\/a> or any other tool of your choice to make the HTTP request to the application endpoints.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Endpoints<\/em><\/span><\/p>\n<pre class=\"brush:plain;\">\/\/ add an employee\n\/\/ http post\nhttp:\/\/localhost:3000\/api\/employee\n\n\/\/ get all employees\n\/\/ http get\nhttp:\/\/localhost:3000\/api\/employees\n\n\/\/ get an employee\n\/\/ http get\nhttp:\/\/localhost:3000\/api\/employee\/xxxx_employee_id\n\n\/\/ update an employee\n\/\/ http put\nhttp:\/\/localhost:3000\/api\/employee\/xxxx_employee_id\n\n\/\/ delete an employee\n\/\/ http delete\nhttp:\/\/localhost:3000\/api\/employee\/xxxx_employee_id\n<\/pre>\n<p>That is all for this tutorial and I hope the article served you with whatever you were looking for. Happy Learning and do not forget to share!<\/p>\n<h2>5. Summary<\/h2>\n<p>In this tutorial, we learned about integrating Firebase in the nodejs application. Firebase offers a real-time database that offers the data to be stored in a JSON format and offers a fast way to implement the BaaS solution. You can download the source code and the postman collection from the <a href=\"#projectDownload\">Downloads<\/a> section.<\/p>\n<h2><a name=\"projectDownload\"><\/a>6. Download the Project<\/h2>\n<p>This was a tutorial to integrate Firebase in the nodejs application.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>You can download the full source code of this example here: <a href=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2021\/11\/Firebase-Cloud-Firestore-using-Node.js_.zip\"><strong>Firebase Cloud Firestore using Node.js<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Hello. In this tutorial, we will explain the implementation of Firebase Firestore in the node.js application. The application will be responsible to perform the crud operations. 1. Introduction Firebase is a Backend-as-a-Service (BaaS) that helps to store real-time data in the database. Allows syncing the real-time data across all devices. Features &#8211; Serverless Highly secure &hellip;<\/p>\n","protected":false},"author":26931,"featured_media":20900,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1879],"tags":[741],"class_list":["post-112052","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-node-js"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Firebase Cloud Firestore using Node.js - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"Hello. In this tutorial, we will explain the implementation of Firebase Firestore in the node.js application. The application will be responsible to\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/firebase-cloud-firestore-using-node-js.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Firebase Cloud Firestore using Node.js - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"Hello. In this tutorial, we will explain the implementation of Firebase Firestore in the node.js application. The application will be responsible to\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/firebase-cloud-firestore-using-node-js.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2021-11-17T05:00:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/01\/javascript-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Yatin Batra\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Yatin Batra\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/firebase-cloud-firestore-using-node-js.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/firebase-cloud-firestore-using-node-js.html\"},\"author\":{\"name\":\"Yatin Batra\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/cda31a4c1965373fed40c8907dc09b8d\"},\"headline\":\"Firebase Cloud Firestore using Node.js\",\"datePublished\":\"2021-11-17T05:00:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/firebase-cloud-firestore-using-node-js.html\"},\"wordCount\":854,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/firebase-cloud-firestore-using-node-js.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/01\\\/javascript-logo.jpg\",\"keywords\":[\"Node.js\"],\"articleSection\":[\"JavaScript\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/firebase-cloud-firestore-using-node-js.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/firebase-cloud-firestore-using-node-js.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/firebase-cloud-firestore-using-node-js.html\",\"name\":\"Firebase Cloud Firestore using Node.js - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/firebase-cloud-firestore-using-node-js.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/firebase-cloud-firestore-using-node-js.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/01\\\/javascript-logo.jpg\",\"datePublished\":\"2021-11-17T05:00:00+00:00\",\"description\":\"Hello. In this tutorial, we will explain the implementation of Firebase Firestore in the node.js application. The application will be responsible to\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/firebase-cloud-firestore-using-node-js.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/firebase-cloud-firestore-using-node-js.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/firebase-cloud-firestore-using-node-js.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/01\\\/javascript-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2014\\\/01\\\/javascript-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/firebase-cloud-firestore-using-node-js.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Web Development\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/web-development\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"JavaScript\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/web-development\\\/javascript\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Firebase Cloud Firestore using Node.js\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/cda31a4c1965373fed40c8907dc09b8d\",\"name\":\"Yatin Batra\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/Yatin.batra_.jpg\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/Yatin.batra_.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/12\\\/Yatin.batra_.jpg\",\"caption\":\"Yatin Batra\"},\"description\":\"An experience full-stack engineer well versed with Core Java, Spring\\\/Springboot, MVC, Security, AOP, Frontend (Angular &amp; React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).\",\"sameAs\":[\"https:\\\/\\\/www.javacodegeeks.com\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/yatin-batra\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Firebase Cloud Firestore using Node.js - Java Code Geeks","description":"Hello. In this tutorial, we will explain the implementation of Firebase Firestore in the node.js application. The application will be responsible to","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/firebase-cloud-firestore-using-node-js.html","og_locale":"en_US","og_type":"article","og_title":"Firebase Cloud Firestore using Node.js - Java Code Geeks","og_description":"Hello. In this tutorial, we will explain the implementation of Firebase Firestore in the node.js application. The application will be responsible to","og_url":"https:\/\/www.javacodegeeks.com\/firebase-cloud-firestore-using-node-js.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2021-11-17T05:00:00+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/01\/javascript-logo.jpg","type":"image\/jpeg"}],"author":"Yatin Batra","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Yatin Batra","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/firebase-cloud-firestore-using-node-js.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/firebase-cloud-firestore-using-node-js.html"},"author":{"name":"Yatin Batra","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/cda31a4c1965373fed40c8907dc09b8d"},"headline":"Firebase Cloud Firestore using Node.js","datePublished":"2021-11-17T05:00:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/firebase-cloud-firestore-using-node-js.html"},"wordCount":854,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/firebase-cloud-firestore-using-node-js.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/01\/javascript-logo.jpg","keywords":["Node.js"],"articleSection":["JavaScript"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/firebase-cloud-firestore-using-node-js.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/firebase-cloud-firestore-using-node-js.html","url":"https:\/\/www.javacodegeeks.com\/firebase-cloud-firestore-using-node-js.html","name":"Firebase Cloud Firestore using Node.js - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/firebase-cloud-firestore-using-node-js.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/firebase-cloud-firestore-using-node-js.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/01\/javascript-logo.jpg","datePublished":"2021-11-17T05:00:00+00:00","description":"Hello. In this tutorial, we will explain the implementation of Firebase Firestore in the node.js application. The application will be responsible to","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/firebase-cloud-firestore-using-node-js.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/firebase-cloud-firestore-using-node-js.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/firebase-cloud-firestore-using-node-js.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/01\/javascript-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2014\/01\/javascript-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/firebase-cloud-firestore-using-node-js.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Web Development","item":"https:\/\/www.javacodegeeks.com\/category\/web-development"},{"@type":"ListItem","position":3,"name":"JavaScript","item":"https:\/\/www.javacodegeeks.com\/category\/web-development\/javascript"},{"@type":"ListItem","position":4,"name":"Firebase Cloud Firestore using Node.js"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/cda31a4c1965373fed40c8907dc09b8d","name":"Yatin Batra","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/Yatin.batra_.jpg","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/Yatin.batra_.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/12\/Yatin.batra_.jpg","caption":"Yatin Batra"},"description":"An experience full-stack engineer well versed with Core Java, Spring\/Springboot, MVC, Security, AOP, Frontend (Angular &amp; React), and cloud technologies (such as AWS, GCP, Jenkins, Docker, K8).","sameAs":["https:\/\/www.javacodegeeks.com"],"url":"https:\/\/www.javacodegeeks.com\/author\/yatin-batra"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/112052","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/26931"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=112052"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/112052\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/20900"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=112052"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=112052"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=112052"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}