feat: mongodb readyState

This commit is contained in:
arashsheyda
2023-04-25 16:25:42 +03:00
parent 58ca500acc
commit 150954290c
4 changed files with 44 additions and 3 deletions

View File

@ -2,10 +2,13 @@ import { logger } from '@nuxt/kit'
import mongoose from 'mongoose'
import type { NuxtDevtoolsServerContext, ServerFunctions } from '../types'
export function setupDatabaseRPC({ nuxt, options }: NuxtDevtoolsServerContext): any {
export function setupDatabaseRPC({ options }: NuxtDevtoolsServerContext): any {
mongoose.connect(options.uri, options.options)
return {
async readyState() {
return mongoose.connection.readyState
},
async createCollection(name: string) {
return await mongoose.connection.db.createCollection(name)
},