gpt4 book ai didi

node.js - MongoError : ns not found when try to drop collection

转载 作者:IT老高 更新时间:2023-10-28 11:03:28 26 4
gpt4 key购买 nike

当我尝试删除集合时,Mongoose 会抛出错误,即“MongoError: ns not found”。

这是我的 Mongoose 代码:

var mongoose = require('bluebird').promisifyAll(require('mongoose'));
......
......
......
mongoose.connection.db.dropCollection("myCollection",function(err,affect){
console.log('err',err);

})

错误:

err { [MongoError: ns not found]
name: 'MongoError',
message: 'ns not found',
ok: 0,
errmsg: 'ns not found' }

最佳答案

MongoError: ns not found 在对不存在的集合执行操作时发生。

例如,尝试在显式创建集合之前或在将文档添加到隐式创建集合的集合之前删除索引。

关于node.js - MongoError : ns not found when try to drop collection,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37136204/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com