草庐IT

User_type

全部标签

c# - Mongodb - 实体序列化正常,但反序列化时出现 'No serializer found for type' 错误

我在使用mongodb(v1.5)的c#驱动程序时遇到了这个问题我在序列化对象时遇到过类似的问题,但过去总是能够通过在应用程序启动期间向mongodb注册实体来解决这个问题。它在反序列化时遇到问题的文档嵌套了两层(即嵌入在文档中的文档中嵌入的文档)。类看起来像这样:[BsonIgnoreExtraElements]publicclassFooItem:IFooItem{[BsonId]publicObjectIdId{get;set;}publicIFooAccessRestrictionsAccessRestrictions{get;set;}}publicclassFooAcces

mongodb - 在本地工作,但在 Heroku 上给出 "uninitialized constant User (NameError)"

我在Heroku上使用Rails、MongoDB和Mongoid。我正在使用Devise进行用户身份验证。User应该是Devise创建的模型的名称。当我在本地运行它时,一切正常,但在Heroku上,应用程序崩溃并在日志中出现以下错误。/app/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/inflector/methods.rb:230:in`blockinconstantize':uninitializedconstantUser(NameError) 最佳答案

C# MongoDB 驱动程序 : Can I use generic type for BsonId?

我有这样一个类:publicclassMyClass{[BsonId]publicGuidMyId{get;privateset;}//someotherproperties...[BsonConstructor]publicMyClass(Guidid){MyId=id;//setsomeotherproperties...}}这最近重构了一些东西。上面的代码有一系列的测试覆盖它,在重构之前都通过了。现在我有这样一个类:publicclassMyClass{[BsonId]publicTMyId{get;privateset;}//someotherproperties...[Bso

c# - 带有字符串参数的 MongoDb c# Driver typed Builder

如何使用stringfieldname和value实现类型化的Builder,如以下代码所示:Builders.Filter.Eq(fieldName,value)我可以使用BsonDocument数据类型来实现它,但我需要检索类型化的ProfileFilterDifinition。 最佳答案 存在从string到FilterDefinition的隐式转换,因此您可以像以前一样使用它。例如:varprofile=awaitcollection.Find(Builders.Filter.Eq("Name","bar")).Single

c# - 如何解决 "exception of type ' AutoMapper.AutoMapperMappingException' occurred in AutoMapper"- "Error mapping types"?

我的实体publicpartialclassUsers{publicUsers(){sexs=newHashSet();}[BsonElement("_id")][BsonId]publicObjectIdUserID{get;set;}publicstringusername{get;set;}publicstringemail{get;set;}publicvirtualICollectionsexs{get;set;}}publicpartialclassTa{publicstringmale{get;set;}publicstringfemale{get;set;}}publi

javascript - 编译一次后无法覆盖 `User` 模型,而编译一次模型 ' '(或者我已经监督了一些东西)

这个问题在这里已经有了答案:CannotoverwritemodeloncecompiledMongoose(42个回答)关闭6年前。你能帮帮我吗?我看不出这里有什么问题。这是来自server.js的代码片段:varmongoose=require('mongoose');varMongoClient=require('mongodb').MongoClient,assert=require('assert');vardb='nodebook';varurl=''mongoose.createConnection('mongodb://localhost/'+db);//TheUser

MongoDB : Find duplicate when field type is not the same

即使字段类型不同,我如何检测重复?{id:1,price:5}{id:2,price:"6"}{id:3,price:"5"}所以重复是{id:1,price:5}{id:3,price:"5"} 最佳答案 您可以使用$substr将索引从0到-1(字符串的其余部分)转换为字符串。:db.duplicates.aggregate([{"$project":{id:1,price:{$substr:["$price",0,-1]}}},{"$group":{"_id":"$price","count":{"$sum":1},"item

node.js - 蒙哥错误: can't convert from BSON type missing to Date while Grouping records in nested documents

基本上我想根据月份对民意调查进行分组。我的模型:varmongoose=require('mongoose');varSchema=mongoose.Schema;varvoteSchema=newSchema({ip:String,votedOn:{type:Date,default:Date.now}});varchoiceSchema=newSchema({text:String,votes:[voteSchema]});varPollSchema=newSchema({question:{type:String,required:true},choices:[choiceSch

node.js - Bcrypt 密码比较不起作用。 Node.js Express App 中甚至 user.password 为空

在这里,我正在使用Node.jsExpress应用程序学习MongoDB。我正在使用Bcrypt保护我的密码。在mongodb中加密和保存是成功的,但是当我尝试比较SigIn的密码时,它只是失败了。SignUprouterouter.post('/signUp',(req,res,next)=>{letuserData=req.body;mongoose.connect(DB_URL,{useNewUrlParser:true},(err)=>{if(err)throwerr;console.log('DBisconnectedSuccessfully');bcrypt.hash(us

ruby - "NameError: uninitialized constant User::MongoMapper"尝试 MongoMapper 'Getting Started'

这是我的irbsession:irb(main):001:0>classUserirb(main):002:1>includeMongoMapper::Documentirb(main):003:1>key:name,Stringirb(main):004:1>key:age,Integerirb(main):005:1>many:hobbiesirb(main):006:1>endNameError:uninitializedconstantUser::MongoMapperfrom(irb):2irb(main):007:0>在http://mongomapper.com/的右边我