Skip to content

Instantly share code, notes, and snippets.

@ankitarora05
ankitarora05 / gist:85bf734d1b5785329b4dfaff4c40c624
Last active August 23, 2024 08:24
Generate mongoose schema for your MongoDB database model from dynamic JSON objects with mixed types
const mongoose = require('mongoose');
// Example JSON object with mixed types in arrays
const json = {
"name": "John Doe",
"age": 30,
"email": "john.doe@example.com",
"isActive": true,
"roles": [
{"role": "admin", "level": 1},
@ankitarora05
ankitarora05 / nuxt.config.js
Last active July 30, 2022 23:28
Automatically detect and update new PWA Workbox builds in nuxt.js
plugins: [{src: '@/plugins/pwa-update.js', mode: 'client'}]
pwa: {
workbox: {
cachingExtensions: "@/plugins/workbox-range-request.js",
skipWaiting: true
},
}