feat: duplicate document

This commit is contained in:
arashsheyda
2023-04-26 17:45:11 +03:00
parent 8d8eed3e75
commit f40c48370c
2 changed files with 6 additions and 5 deletions

View File

@ -23,7 +23,8 @@ export function setupDatabaseRPC({ options }: NuxtDevtoolsServerContext): any {
},
async createDocument(collection: string, data: any) {
return await mongoose.connection.db.collection(collection).insertOne(data)
const { _id, ...rest } = data
return await mongoose.connection.db.collection(collection).insertOne(rest)
},
async listDocuments(collection: string) {
return await mongoose.connection.db.collection(collection).find().toArray()