This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Users collection | |
| { | |
| "_id" : ObjectId("6342ef6f73d381100e27b8e4"), | |
| "name" : "Juan", | |
| "age" : 40 | |
| } | |
| // Address collection | |
| { | |
| "_id" : ObjectId("6342efb173d381100e27b8e5"), | |
| "street" : "Fifth Avenue", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as mongoose from "mongoose"; | |
| import { Schema, Document } from "mongoose"; | |
| export interface IUser extends Document { | |
| _id?: string; | |
| username: string; | |
| email: string; | |
| password: string; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fetchPokemon = (name) => new Promise((resolve, reject) => { | |
| setTimeout(() => { | |
| const pokemon = ["Pikachu"]; | |
| const search = pokemon.find((poke) => poke === name); | |
| if (search) { | |
| resolve(`Resolve: The Pokemon ${name} is found`) | |
| } | |
| reject(`Reject: The Pokemon ${name} is not found`); | |
| }, 2000); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: "3.7" | |
| services: | |
| mongo: | |
| image: mongo | |
| environment: | |
| - MONGO_INITDB_ROOT_USERNAME=root_user | |
| - MONGO_INITDB_ROOT_PASSWORD=root_password | |
| - MONGO_INITDB_DATABASE=admin | |
| restart: always |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: "3.7" | |
| services: | |
| db: | |
| image: mysql | |
| restart: always | |
| environment: | |
| MYSQL_DATABASE: "database" | |
| MYSQL_USER: "mysql" | |
| MYSQL_PASSWORD: "mysql" | |
| MYSQL_ROOT_PASSWORD: "mysql" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: "3.7" | |
| services: | |
| db: | |
| image: postgres | |
| restart: always | |
| environment: | |
| - POSTGRES_USER=postgres | |
| - POSTGRES_PASSWORD=postgres | |
| ports: | |
| - "5432:5432" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: '3.7' | |
| services: | |
| grafana: | |
| image: grafana/grafana:5.1.0 | |
| ports: | |
| - 3000:3000 | |
| # docker-compose -f grafana.yml up | |
| # docker-compose -f grafana.yml down |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| version: "3.7" | |
| services: | |
| db: | |
| image: redis | |
| restart: always | |
| ports: | |
| - "6379:6379" | |
| volumes: | |
| - redis_volume:/bitnami/redis/data | |
| volumes: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const Sentry = require("@sentry/node"); | |
| // Importing @sentry/tracing patches the global hub for tracing to work. | |
| const SentryTracing = require("@sentry/tracing"); | |
| Sentry.init({ | |
| dsn: "", | |
| // We recommend adjusting this value in production, or using tracesSampler | |
| // for finer control |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let { exec } = require('child_process'); | |
| let command = 'mongoimport -d database -c cars --file cars.json --jsonArray'; | |
| exec(command, (err, stdout, stderr) => { | |
| if (err) throw err; | |
| console.log(stderr); | |
| }); |