Skip to content

Instantly share code, notes, and snippets.

View kiranvj's full-sized avatar
💭
Brewing the awesome.....

Kiran Paul kiranvj

💭
Brewing the awesome.....
View GitHub Profile
@spf13
spf13 / Genealogy.js
Created February 3, 2012 18:13
Genealogy Schema for MongoDB
individual = {
_id : ObjectId("4f2978dfaa999d9db02618ce"),
AFN : '1XYK-KQJ',
name: {
first: ['john', 'johannes'],
middle: 'peter',
last: ['smith', 'sandvik']
},
events : [
@ilyazub
ilyazub / puppeteer-reuse-cookie-in-http-request-from-node.js
Last active January 9, 2025 11:06
Reuse `puppeteer` cookies in `tough-cookie` and `got`
@kiranvj
kiranvj / mongodb.js
Last active October 28, 2024 09:03
Nodejs/NextJS reusable mongodb connection and CURD operations
// MongoDB connection
import { MongoClient } from 'mongodb'; // install package first
const { MONGODB_URI/* connection string*/, MONGODB_DB /*db name*/ } = process.env;
if (!MONGODB_URI) {
throw new Error(
'Please define the MONGODB_URI environment variable inside .env.local'
);