Mongoose supports virtual attributes. Virtual attributes are attributesthat are convenient to have around but that do not get persisted to mongodb. When we have m:1, m:n relationship, we may need to fetch all related data. For example; we have User and Portfolio schemas and Portfolio has user ID as foreign key. Let’s suppose when we …
Laravel-Livewire
Livewire is a full-stack framework for Laravel that makes building dynamic interfaces simple, without leaving the comfort of Laravel. Building modern web apps is hard. Tools like Vue and React are extremely powerful, but the complexity they add to a full-stack developer’s workflow is insane. It’s not like anything you’ve seen before, the best way to …
Kibana – Your window into the Elastic Stack
Kibana is a free and open user interface that lets you visualize your Elasticsearch data and navigate the Elastic Stack. Do anything from tracking query load to understanding the way requests flow through your apps. Build visualizations simply and intuitively Start exploring even if you’re not sure where you’re headed. Drag and drop fields, and …
google oauth2 – googleapis
We can use googleapis npm to implement google oauth2 functionality.Main thing is to create new one by refresh token when access token is expired. Get authorization code from client. Get refresh token from authorization code. Add following code to generate access token automatically when it is expired oauth2Client.on(‘tokens’, (tokens) => { if (tokens.refresh_token) { // store the refresh_token in my database! console.log(tokens.refresh_token); } console.log(tokens.access_token);});
Advanced Custom Fields for WordPress Developers
The basics Custom fields are a native part of WordPress and appear on pages, posts and custom post types, however, the native custom field interface is not very user friendly. With ACF installed, you can tailor what fields to show and what they look like. For instance, you may require a ‘Hero Image’ to be …
Arbitrary reference in Mongoose schema
Supposing you need parent reference of Task schema, and parent can be either manager or developer. You don’t have to define both reference IDs in Task schema. Instead MongoDB provides feature to define arbitrary reference. You can assign value as Manager schema ID or Developer schema ID.