MongoError:尝试删除集合时找不到ns [英] MongoError: ns not found when try to drop collection

查看:677
本文介绍了MongoError:尝试删除集合时找不到ns的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

猫鼬抛出错误,即当我尝试删除集合时出现" MongoError:未找到ns ".

Mongoose throw an error i.e, "MongoError: ns not found" when i try to drop collection.

这是我的猫鼬代码:

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

})

错误:

err {[MongoError:未找到ns]
名称:"MongoError",
讯息:'ns 找不到",
好的:0,
errmsg:未找到ns"}

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

对不存在的集合执行操作时,会发生

推荐答案

MongoError: ns not found.

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

For example, attempting to drop indexes before an explicit collection creation has occurred or before adding a document to the collection which implicitly creates the collection.

这篇关于MongoError:尝试删除集合时找不到ns的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆