草庐IT

Size_type

全部标签

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

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

ruby-on-rails-3 - mongoid 查询 - 调用 size 方法产生错误

当我执行这个查询时:User.where(:comments.size=>10)我收到以下错误:undefinedmethod`size'for:comments:Symbol但是根据这里的文档:http://mongoid.org/docs/querying/criteria.html这应该是可能的。那么,为什么会出错?注意:'comments'是独立于User的集合,具有'has_and_belongs_to_many'关系。我正在使用mongoid3.0.0和bson_ext1.6.1提前致谢! 最佳答案 这在用户嵌入评论时有

Mongodb 副本集 : Database Size Difference

MongoDB副本集的主从节点数据库大小不同的可能原因是什么?在我的设置中,辅助节点数据库的大小大于主节点数据库。两个节点具有相同数量的对象,但辅助节点的“avgObjSize”、“dataSize”、“storageSize”值更高。从rs.stats()中检查也没有复制滞后我可以检查什么? 最佳答案 简介:由于次级上未回收的内存空间量不同以及次级和初级上的不同填充因子。长:如果您有长期运行的主节点,其中一些文档被删除和插入,并且没有运行紧凑操作,则可能是这种情况。此空间将不会被回收,并将计入dataSize、avgObjSize

javascript - MongoDB 外壳 : Query BinData by Type

我正在尝试通过使用BinData的_id字段查询大型集合。其中一些ID使用类型4的BinData:"_id":BinData(4,"CNDF66qIlCY92q1vFAAAAQ==")虽然有些使用类型3的BinData:"_id":BinData(3,"CNDF66qJ29g92q1vFAAAEw==")我需要找到BinData.type=3的所有_id字段,并且想知道是否有人在MongoDBshell中幸运地进行了这样的查询。如有任何帮助,我们将不胜感激! 最佳答案 您可以使用$where样式查询来执行此操作,因为BinData对

node.js - 范围错误 : Maximum call stack size exceeded with mongoose

我正在尝试使用时间段进行聚合。然后,我想返回一个充满每天值的数组(没有找到文档时为0)。aggeagate函数工作得很好,但是当我像这样替换回调(以前的console.log)时:Star.aggregate([{$match:{"mod":newmongoose.Types.ObjectId("53765a122c0cda28199df3f4"),"time_bucket.month":newTimeBucket().month}},{$group:{_id:"$time_bucket.day",stars:{"$sum":1}}},{$sort:{'_id':1}}],functi

ruby - 使用 GridFS 时出现 "Document exceeds allowed max BSON size. The max is 16777216."错误

我正在尝试使用GridFS和ruby​​在我的mongo数据库中插入一个33MB的视频文件,并且我有一个系统的“文档超出允许的最大BSON大小。最大值为16777216。”。我认为在mongo集合中插入大于16MB的文件的唯一方法是使用Gridfs,所以我怀疑我做错了,即使我复制/粘贴了Ruby驱动程序示例(http://docs.mongodb.org/ecosystem/tutorial/ruby-driver-tutorial/#gridfs)。我正在使用Ruby2.2.1、mongo驱动程序2.0.4和mongodb3.0.1。我的代码:eDatabase=Mongo::Cli