What do you want to save?
Add Code snippet
New code examples
-
Html 2022-02-18 02:55:08
what is Mongoose
import express from 'express'; or const exporess = require('express'); import mongoose from 'mongoose'; or const mongoose = require('mongoose'); const app = express(); mongoose.connect('mongodb://localhost:27017/mongo-tree' , { useNewUrlParser: true, ... Add solution -
Javascript 2022-01-30 23:12:02
mongodb database pooling
import mongoose from 'mongoose' mongoose.connect(process.env.MONGO_URI, { minPoolSize: 1, maxPoolSize: 20, compression: { compressors: ['zlib'] }, useUnifiedTopology: true, useNewUrlParser: true, useFindAndModify: false, socketTimeoutMS: 6... Add solution -
Javascript 2021-11-20 18:44:23
How to connect mongoDB using mongoose
import mongoose from 'mongoose' export const connectDb = async () => { try { await mongoose.connect('mongodb://localhost:27017/test', { useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true, }) } catch (er... Add solution -
TypeScript 2021-10-29 21:01:11
mongoose typescript global promise
import mongoose from 'mongoose' import consola from 'consola' import q from 'q' export const mongooseConnection = (): void => { mongoose.Promise = q.Promise mongoose.connect(process.env.MONGO_URI, { minPoolSize: 1, maxPoolSize: 20, compressio... Add solution -
Javascript 2021-10-27 18:53:06
mongoose database pooling
import mongoose from 'mongoose' mongoose.connect(process.env.MONGO_URI, { minPoolSize: 1, maxPoolSize: 20, compression: { compressors: ['zlib'] }, useUnifiedTopology: true, useNewUrlParser: true, useFindAndModify: false, socketTimeoutMS: 6... Add solution -
Javascript 2021-10-23 22:14:08
Cast to ObjectId failed for value "t" at path "_id" for model "User"
// it happens when you pass an invalid id to mongoose. // so first check it before proceeding, using mongoose isValid function import mongoose from "mongoose"; // add this inside your route if( !mongoose.Types.ObjectId.isValid(id) ) return fa... Add solution
Best helpers
Ranking is empty