Recursively Clean Firestore FieldValue.delete()

This morning I had to improve a function we used in DeckDeckGo to recursively clean objects after persistence. Because I am currently quite busy but would not like to push my blogging habits too much on the side, I got the idea that this small “hack” would be a nice subject for a new blog post 🤗.

Introduction

When you use Cloud Firestore, in order to delete specific fields from a document, you have to use the FieldValue.delete() method when you update a document (as displayed in the documentation).

For example, your database contains a document such as the following:

{
  description: 'Hello World'
}

You would have to use the above method to remove it, as setting it for example to null would not remove the attribute but “only” set its value to null .

import * as firebase from 'firebase/app';
import 'firebase/firestore';

const firestore = firebase.firestore();

const ref = firestore.collection('users').doc('david');
const user = {
  description: firebase.firestore.FieldValue.delete()
};
await ref.update(user);

Thanks to this method, the above document’s example becomes {} in the database.

Issue

This method works like a charm but can lead to an issue. Indeed, if you are not refreshing your local object after its update, it will still contain the method FieldValue.delete() afterwards, which does not reflect its effective value in database.

Concretely, with our above example, if we would print out the user to the console, its output would be the following.

{
  description: n {h_: n}
}

This can lead to some unexpected behavior in your application, if you are still using the object after its update, notably if it is a state.

#firebase #programming #javascript #firestore #web-development

What is GEEK

Buddha Community

Recursively Clean Firestore FieldValue.delete()

Jackson George

1604649613

ECS: Residential & Commercial Cleaning Services in London

Specializing in commercial cleaning, office cleaning, hospital & GP surgery cleaning, residential cleaning, washroom cleaning, school cleaning, Covid cleaning and sanitization, ECS Commercial Cleaning Company London has built up a large, experienced team of highly-skilled team of professionals who ensures work is delivered to highest standards, on time and on budget.

At ECS Commercial Cleaning, we provide a safe, cost-effective and efficient service that covers all your commercial cleaning needs. From residential cleaning, washroom cleaning, school cleaning to office cleaning, hospital & GP surgery cleaning, we cater it all. We have years of experience with all kinds of projects and know the best approach to save you time and money. Our professional knowledge and skills has enabled us to provide high quality cleaning solutions throughout London.

We’ve been delivering commercial cleaning services throughout London with the help of trained and experienced professionals, using only the finest equipment and cleaning solutions. Our team starts cleaning project from initial consultation through to completion on budget and schedule.

ECS Commercial Cleaning strives to keep people first, investing in their professional training and safety. We work hard to create and sustain an environment that helps us to achieve clients’ expectations through consistently excellent service and minimal downtime.

Our Services

With 10 years of market experience, a resource of professional employees and coverage throughout the London, ECS Commercial Cleaning has established itself as one of the leading commercial cleaning company, offering valuable cleaning solutions including:

  • commercial cleaning
  • office cleaning
  • hospital & GP surgery cleaning
  • residential cleaning
  • washroom cleaning
  • school cleaning
  • covid cleaning and sanitization

Our clients are the London’s leading retail outlets, office buildings and office premises, schools, hospitals, production and industrial premises and others. Our cleaning solutions offers peace of mind to clients and most importantly ensure that workers are able to do their jobs comfortably and efficiently without compromising safety. Over the years of industry experience, we remain at the forefront of our industry due to our unparalleled customer dedication and unrivalled experience in providing safe, and cost-effective cleaning solutions.

Our Expert Team

ECS Commercial Cleaning provides you with an expert team that completes your cleaning project professionally and efficiently. No matter what cleaning service you require, our aim is to work closely with our clients in order to comprehend their needs and fulfil their specific requirements through tailored cleaning solutions.

With our eco-friendly cleaning products and a team of experienced professionals, we can provide timely cleaning solutions to our clients. Contact ECS Commercial Cleaning on 0161 5462235.

#cleaning #commercial cleaning #office cleaning #residential cleaning #washroom cleaning #covid cleaning and sanitization

Seamus  Quitzon

Seamus Quitzon

1595201363

Php how to delete multiple rows through checkbox using ajax in laravel

First thing, we will need a table and i am creating products table for this example. So run the following query to create table.

CREATE TABLE `products` (
 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
 `description` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 `created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
 `updated_at` datetime DEFAULT NULL,
 PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

Next, we will need to insert some dummy records in this table that will be deleted.

INSERT INTO `products` (`name`, `description`) VALUES

('Test product 1', 'Product description example1'),

('Test product 2', 'Product description example2'),

('Test product 3', 'Product description example3'),

('Test product 4', 'Product description example4'),

('Test product 5', 'Product description example5');

Now we are redy to create a model corresponding to this products table. Here we will create Product model. So let’s create a model file Product.php file under app directory and put the code below.

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    protected $fillable = [
        'name','description'
    ];
}

Step 2: Create Route

Now, in this second step we will create some routes to handle the request for this example. So opeen routes/web.php file and copy the routes as given below.

routes/web.php

Route::get('product', 'ProductController@index');
Route::delete('product/{id}', ['as'=>'product.destroy','uses'=>'ProductController@destroy']);
Route::delete('delete-multiple-product', ['as'=>'product.multiple-delete','uses'=>'ProductController@deleteMultiple']);

#laravel #delete multiple rows in laravel using ajax #laravel ajax delete #laravel ajax multiple checkbox delete #laravel delete multiple rows #laravel delete records using ajax #laravel multiple checkbox delete rows #laravel multiple delete

Jackson George

1607673140

An Outstanding Office Cleaning and Commercial Cleaning Services London

Do you need to turn to a reputable company that offers an outstanding office cleaning and commercial cleaning services London? Maybe you need a DBS checked cleaners London? In either case, ECS Commercial Cleaning is the right choice for you. We are one of the best cleaning company ready to meet all your cleaning needs and will do so in a timely and efficient manner.

We offer office cleaning, commercial cleaning, and sanitisation and specialist cleaning London to our customers for either their home or business. We take pride in providing customized office cleaning and commercial cleaning services London, regardless the size of your facility. Our goal is to provide a 100% satisfactory experience and ensure your facility is sanitized, providing a productive and safe environment for employees and customers. We constantly stay on the cutting edge of technology to provide you with the best quality and most efficient cleaning services.

Skilled Cleaning Services

Our company has been providing skilled office and commercial cleaning services across London for over 10 years. Our experience, coupled with DBS checked cleaners London, has allowed us to make efficient use of the best processes, cleaning products, and supplies to get the job done quickly and effectively without any disruption. Whether you require regular or one-time cleaning services, we will customize cleaning program specifically according to your needs. ECS Commercial Cleaning has the resources and expertise to get the job done right the first time.

Professional Experts and Advanced Technology

We have DBS checked cleaners who are thoroughly trained and experienced in providing high quality cleaning services that dramatically decrease dust and bacteria, from your home and business. ECS Commercial Cleaning team is committed to making your home and business a cleaner and healthier place. With more than 10 years’ experience with providing office cleaning and commercial cleaning services, you can be confident that our team have all the skills required to provide hassle-free services.

Pursue the Highest Standards in Cleaning

At ECS Commercial Cleaning, we persistently follow the highest standards in sanitisation and specialist cleaning with customized programs designed to meet your needs. We have the tools and cleaning supplies to handle your cleaning and disinfecting responsibilities. Our customized cleaning plans make sure that you are getting the best service for the best price.

Our cleaning team is equipped to handle any project, big or small, at any time of day. Call us today at 0161 5462235 to learn more about how, ECS Commercial Cleaning can handle all your office cleaning and commercial cleaning responsibilities in London.

#office cleaning #commercial cleaning #cleaning #cleaning team

Recursively Clean Firestore FieldValue.delete()

This morning I had to improve a function we used in DeckDeckGo to recursively clean objects after persistence. Because I am currently quite busy but would not like to push my blogging habits too much on the side, I got the idea that this small “hack” would be a nice subject for a new blog post 🤗.

Introduction

When you use Cloud Firestore, in order to delete specific fields from a document, you have to use the FieldValue.delete() method when you update a document (as displayed in the documentation).

For example, your database contains a document such as the following:

{
  description: 'Hello World'
}

You would have to use the above method to remove it, as setting it for example to null would not remove the attribute but “only” set its value to null .

import * as firebase from 'firebase/app';
import 'firebase/firestore';

const firestore = firebase.firestore();

const ref = firestore.collection('users').doc('david');
const user = {
  description: firebase.firestore.FieldValue.delete()
};
await ref.update(user);

Thanks to this method, the above document’s example becomes {} in the database.

Issue

This method works like a charm but can lead to an issue. Indeed, if you are not refreshing your local object after its update, it will still contain the method FieldValue.delete() afterwards, which does not reflect its effective value in database.

Concretely, with our above example, if we would print out the user to the console, its output would be the following.

{
  description: n {h_: n}
}

This can lead to some unexpected behavior in your application, if you are still using the object after its update, notably if it is a state.

#firebase #programming #javascript #firestore #web-development

Office Cleaning Services Singapore | Nea Certified | Homeworz

Cleaning doesn’t mean mopping, vacuuming, and emptying trash bins. It has more significant values and procedures to place in order. When you hire professional office cleaning services, Singapore ensures that appropriate services are served to get your office back into a neat and tidy place. Experienced professionals ensure that all the hidden dust, dirt, allergens, and pathogens that remain in premises are eliminated appropriately.

Some Significant reasons to hire a professional cleaning service Singapore company over an ordinary one:

  • Analysation of the amount of work that needs to be done
  • Qualified staff that use their experience and knowledge
  • Cost-effective services with health safety promises
  • Accountability after work
  • Easy to approach and questioning if work is not performed appropriately
  • Bring Industry standards equipment into practice for quick and prompt services

What are some benefits of hiring professional office cleaning services in Singapore?

  1. Productivity
    Your employees feel more productive when they get a fresh, clean, and tidy working environment. Nobody wants to perform their duties where a clean working environment is not promoted. Bad and unclean surfaces may lead to serious health issues for people who work there.
    Furthermore, it is mandatory as per the government’s terms to keep the work environment efficient and clean for people who spend half of their valuable time to boost the business’s sales. Lately, a survey has found that more productivity can be obtained if organizations promote and support healthy work environment culture.

  2. Boost Sales
    Businesses are easy to open but hard to run appropriately due to high competition. However, a clean work environment is a small thing if you can take care of. In return, you may get double business to believe it or not. Lately, an incident occurred when a business owner performed hard duties but could not obtain huge clients.
    One day he approached an overseas client, and they agreed to visit the company’s office. The client found the premises well maintained, clean and admirable to perform work duties. The client was very impressed, and they signed the contract with the company to work together for upcoming years. Here the kudos goes to the owner who loved to keep the premises clean and office cleaning services Singapore performed cleaning duties.

  3. Long Tenure Cost Savings
    In general, most companies hesitate to hire professional cleaning services in Singapore. They have the ideology that such services are expensive and might hamper their office budget. But they seem far from reality. The truth is a regular cleaning employee-only vacuum; mop your floor and empty dustbins. Whereas professional service providers will perform ample work duties that include high and low dusting, thoroughly vacuuming carpets, mopping floors with adequate cleaning agents, remove dust from tables and blinds, and so on.

The Final Words
Your office is your pride, and you won’t want to demolish your satisfaction because of the inappropriate environment. So without having a second thought, opt for office cleaning services in Singapore today and see the difference.

#cleaning services singapore #carpet cleaning singapore #cleaning companies singapore #house cleaning singapore #office cleaning services singapore