Skip to content

Instantly share code, notes, and snippets.

Avatar
🤔
Implementing bugs

bangbang93 bangbang93

🤔
Implementing bugs
View GitHub Profile
View entity.ts
import {Column, CreateDateColumn, Entity, PrimaryGeneratedColumn} from 'typeorm'
@Entity()
export class Test {
@PrimaryGeneratedColumn() id: number
@Column() category: string
@CreateDateColumn() createdAt: Date
}
View mongoose-callback.js
const mongoose = require('mongoose')
mongoose.connect('mongodb://localhost/test')
const schema = new mongoose.Schema({}, {strict: false})
const model = mongoose.model('test', schema)
model.collection.indexExists('users.user_1', (err, res) => {
console.log(err, res)
View mongoose-index.ts
import * as Mongoose from 'mongoose'
Mongoose.connect('mongodb://localhost/test')
Mongoose.set('debug', true)
const schema = new Mongoose.Schema({
a: {
type: String,
}
@bangbang93
bangbang93 / mongoose-findbyidandupdate.js
Last active Nov 5, 2018
mongoose-findbyidandupdate
View mongoose-findbyidandupdate.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const Mongoose = require("mongoose");
Mongoose.connect('mongodb://lo-srv-0.s.chipwing.com/test');
const schema = new Mongoose.Schema({
_id: {
type: Number,
},
a: {
unique: true,
View remove-sina-app.js
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
(() => __awaiter(this, void 0, void 0, function* () {
const now = Date.now();
View gist:b5ec3adf30c31545b22c
var code='iVBORw0KGgoAAAANSUhEUgAAAgQAAAIOCAYAAADHmRXwAAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAACXZwQWcAAAIEAAACDgCE2xfWAACAAElEQVR42u1dCdxU0//Oz1YSpZA9SyoiZZ8IIVkSKku2UBNSabNEikqlZBAK2cq+JYwla2RX1l/x2ve1bH/Lj5z/PN+Ze+fce8+9c+9s78zbM32eT+/M3Lkzc+ae833Od3vq1atXTxEEQRAEscKDg0AQBEEQBAeAIAiCIAgOAEEQBEEQJAQEQRAEQZAQEARBEARBQkAQBEEQRBhCwBtvvPHGG2+81Y1bwYSArIkgCIIgqhskBARBEARBkBAQBEEQBEFCQBAEQRDEikoIYomkSsSivqZG1SRiql48qZLxoGNjKlGTVPESf568PnuBx+iIx+N5niOuUiMYYXwwnjXhxyf1+0T5HrWGWEIlI33O1DgkEyrGRYsgCBICt1EJugUYnNRCXINDaqItrpaxi2EhxzvE/RfueLIGB4Q2DLk/D4xi0NeNe4xirpvz8zvHsyYRN7yfPqZxxxjg+4rBtowx3j/g+6SfjgWOda6b3+tz/z7lBb6r8bPI7x6B6GSuq1zjhvey/revLcPvKGMc9holCIKEoDo8BFF2nDg2a7x8F8QQBtU2kJ5FF4txzHAO02d0fZ6a0uwAc+3cbaOF76J9BtvQu7weDoON463XCSGIR9vR5/q8pt8plxcgljKesdr3EtiG2fdzxlOfM5hMuK8rD1nSfi8jIQgw+jk/H0EQJAR1kxDEPTtHWVxNRjiKERJCkOv9DZ8xQyQ8n6cou9scHgWXEampqfGSF8vIezwYAeNtHKNc3pyswbNIRDg+FvcxnOG9CaWFy8UfDzcK2d8/TKgkNbYFEAL36wmCICGofkKQa1GTxdhncbUW6hrX4m1yw2ceM8b8fRd8t/HUDGTSHIf3GoYIBtLoJg42wJYhT3sE0t6AhE9eg4
You can’t perform that action at this time.