Closed Ena-Heleneto closed 1 year ago
@Abernethy-BY since nuxt-mongoose
is mongoose
, you can use mongoose
directly. an example would be server/api/users.get.ts
:
import mongoose from 'mongoose'
export default defineEventHandler(async (event) => {
try {
return mongoose.connection.db.listCollections().toArray()
}
catch (error) {
return error
}
})
thank you,I understood
I need to use mogoose for query all Collection
Based on the available intelligence, I can do this
but in nuxt-mogoose , I can`t get the connection sample to call the db.listCollections function