草庐IT

CONSTANT_NAME

全部标签

javascript - Mongoose 和node.js中的TypeError : [function name] is not a function,

我是node.js和Mongoose的新手,如果有人能帮助我解决以下错误,我将不胜感激。我通过以下函数发出放置请求(该函数的要点是“赞成”论坛帖子。o.upvote=function(post){return$http.put('/posts/'+post._id+'/upvote').success(function(data){post.upvotes+=1;});};这又转到我的路线:index.js(我的路线)router.put('/posts/:post/upvote',function(req,res,next){req.post.upvote(function(err,

Node.js MongoDB 创建多个索引 : no index name specified

我正在使用MongoDB版本2.6.11如何解决这个错误?在Node.jsAPIreference您可以传递的唯一参数是一个索引规范数组和一个回调函数,我应该在哪里指定索引名称?我正在使用的代码如下(假设我已经需要mongoclient并已连接到数据库):db.collection("MyCollection").createIndexes([{field1:1},{field2:1,field3:1}],function(err,result){//Errorhandlingcode});错误代码为67,错误的完整堆栈跟踪如下:MongoError:noindexnamespecif

javascript - 错误 : name":"Invariant Violation" ,"framesToPop":1

我看到了这个奇怪的错误。我正在编写一个应用程序,它使用图形api从facebook检索事件详细信息。该事件有几个属性:-所有者,它是一个包含所有者ID、所有者名称和其他属性的对象-cover代表事件封面图像细节的对象。我将事件保存在mongo数据库中,这是我的事件模型:constEventSchema=newSchema({title:String,name:String,_id:{type:String,unique:true,default:shortid.generate,},start_time:Date,end_time:Date,description:String,own

Flutter的The file name ‘xxxx.dart‘ isn‘t a snake_case identifier警告

文章目录警告原因分析解决方法dart的一些命名规则变量和函数命名:类和类型命名:常量和枚举:文件命名:包命名:注释:命名一致性:避免缩写:可搜索的命名:一些好习惯警告Thefilename‘xxxx.dart’isn’tasnake_caseidentifier原因分析这个警告指的是文件名‘appRouter.dart’不符合Dart命名约定中的“snake_case”命名规则。在Dart中,通常使用“snake_case”命名规则来命名文件、变量、函数等标识符。解决方法“snake_case”命名规则要求将多个单词用下划线_连接,并且全小写,例如my_file.dart或my_functio

node.js - fatal error : Schema hasn't been registered for model "a". 使用 mongoose.model(name, schema)

我有以下错误:Fatalerror:Schemahasn'tbeenregisteredformodel"a".Usemongoose.model(name,schema)这是我的文件结构:--------a.model.js--------'usestrict';varmongoose=require('mongoose'),Schema=mongoose.Schema;varA=newSchema({name:String,});module.exports=mongoose.model('A',A);--------b.model.js--------'usestrict';va

node.js - GraphQL 错误 : Must provide name

我正在编写用于在NodeJS中登录用户的突变。它给出错误“必须提供名称”。这是浏览器GraphQL查询:mutation{login(username:"dfgdfg",password:"test1234"){_id,name{fname,lname,mname}}}这是我的代码constlogin={type:UserType,args:{input:{name:'Input',type:newGraphQLNonNull(newGraphQLObjectType({username:{name:'Username',type:newGraphQLNonNull(GraphQLSt

mongodb - Chef :mongodb::user_management 失败,出现 "NameError: uninitialized constant Mongo::MongoClient"

几个月来我一直在使用mongodbcookbook成功创建用户帐户,但最近发生了一些变化,我无法弄清楚它是什么。默认配方没有错误地完成并且mongodb服务器安装成功,但是,user_management配方失败并出现错误NameError:uninitializedconstantMongo::MongoClient。这是在AWSOpsworks环境中,Chef版本为11.10,Berkshelf版本为3.2.0。伯克斯文件source"https://supermarket.chef.io"cookbook'mongodb','~>0.16.1',github:'edelight/

javascript - 无法读取未定义的属性 'user_first_name'

我正在尝试使用expressjs/mongoose注册用户,但出现以下错误:TypeError:Cannotreadproperty'user_first_name'ofundefinedatC:\QuizwebPolitica\server.js:20:24atLayer.handle[ashandle_request](C:\QuizwebPolitica\node_modules\express\lib\router\layer.js:95:5)atnext(C:\QuizwebPolitica\node_modules\express\lib\router\route.js:1

django.core.exceptions.ImproperlyConfigured : name must be an instance of basestring

我正在尝试在我的Django中使用Mongodb。下面是settings.py中的连接设置DEBUG=TrueTEMPLATE_DEBUG=DEBUGADMINS=(#('YourName','your_email@example.com'),)MANAGERS=ADMINSDATABASES={'default':{'ENGINE':'django_mongodb_engine','NAME':'','USER':'','PASSWORD':'','HOST':'localhost','PORT':27017,}}当我尝试运行pythonmanage.pysyncdb时,出现如下错误

node.js - 在 Node js中获取 "name"的值

Category=collection.find({},{name:true}).toArray();console.log("CategoriesFound",Category);输出:Promise{[{name:'Agriculture'},{name:'engineer'}]}如何获取name的值?(注意:在NodeJS中工作) 最佳答案 toArray是一个返回promise的异步函数。您可以通过以下两种方式之一获取类别:promise风格:collection.find({},{name:true}).toArray()