草庐IT

any_cast

全部标签

c# - 从 C# 查询 MongoDb - 使用带有谓词的 Linq .Any()

我有一个正在尝试使用C#驱动程序查询的集合。文档结构是:{"_id":3121,"Active":true,"CategoryId":1,"Crci":"IH","CultureId":null,"DateUpdated":{"$date":1381916923120},"Description":"NationalCareersService:Actuary","Keywords":"","MaxLevel":null,"MinLevel":null,"PhoneNumber":"","Priority":1,"Title":"NationalCareersService:Actua

node.js - MongoError : can't find any special indices: 2d (needs index), 2dsphere(需要索引)$nearSphere

这是我的第一个问题,所以如果问得不是很好或者我的英语不好,请耐心等待我。我正在尝试在Node.js中的MongoDB中执行地理空间查询。这个查询工作得很好collection.find({loc:{$geoWithin:{$centerSphere:[[point.coordinates[0],point.coordinates[1]],getRadiusMeters(radius)]}}})但是当我尝试对$nearSphere做同样的事情时:collection.find({loc:{$nearSphere:{$geometry:{type:"Point",coordinates:[

angularjs - Mongoose: 'Cast to embedded failed for value at path. Cannot use ' in' operator to search for '_id'

我在尝试将数组保存在对象数组中时遇到了一些问题。我从服务器收到以下响应:{[CastError:Casttoembeddedfailedforvalue"\'maxbeds:4\'"atpath"saved_searches"]message:'Casttoembeddedfailedforvalue"\\\'maxbeds:4\\\'"atpath"saved_searches"',name:'CastError',kind:'embedded',value:'\'maxbeds:4\'',path:'saved_searches',reason:[TypeError:Cannotu

node.js - 500 错误 : Cast to ObjectId failed for value at path \"_id\" for Mongoose model using ResourceJS

按照本MEANApprepo中的说明逐步安装resourcejs。,当我访问URLhttp://localhost:3000/movie/584c6f00cf996a9956784807时收到以下消息:{"status":500,"message":"CasttoObjectIdfailedforvalue\"584dd2842a056e4a648751b5\"atpath\"_id\"formodel\"movie\"","errors":{}}POST请求也有效,但PUT和DELETE无效。index.jsvarexpress=require('express');varbodyP

node.js - Mongoose 错误 : Cast to embedded failed for value

我正在创建一个mongooseSchema,但我得到了一个MongooseError。这是我的方案:letRestaurantSchema=newSchema({ratings:{type:[{id:Number,value:Number,_id:false}],default:[{id:1,value:0},{id:2,value:0},{id:3,value:0},{id:4,value:0},{id:5,value:0}]},menu:[{ratings:{type:[{id:Number,value:Number,_id:false}],default:[{id:1,value

ruby-on-rails-3 - Mongoid `any_of` 可以包括使用外部文档关系吗?

我将MongoDB与Mongoid一起使用,并在我们查看权重等之前尝试将基本搜索作为占位符。any_of方法似乎正在查找我的嵌入式文档,但不是那些由关系联系起来。有谁知道any_of是否可以包含与数据库中其他文档的关系,如果可以,语法是什么?belongs_to:principal#ownerbelongs_to:account#ownerscope:search,->(text){any_of({:description=>/#{text}/i},{:name=>/#{text}/i},{"entries.title"=>/#{text}/i},{"entries.descripti

mongodb - 如何通过比较子字段构造 MongoDB Linq Any() 查询

我正在尝试构建以下嵌套查询,以便它将在我的C#实体上运行,但通过C#驱动程序正确转换为MongoDB查询;lpn=newList{newPN("/standard"),newPN("/my")};nCollection.AsQueryable(o=>o.pns.Any(pf=>lpn.Any(pn=>pn.n==pf.n))所以这是有效的C#。我正在尝试将值数组与值数组进行匹配,但我在驱动程序堆栈中遇到此错误;ResultMessage:TestmethodMyLib.Tests.Models.ProjectTest.DBImportExcelProjectthrewexception

node.js - Node ,js - Mongoose - 无法保存地理多边形 - CastError : Cast to number failed

我正在尝试将地理点和地理多边形保存到Mongo。我的点测试通过,但多边形失败:CastError:Casttonumberfailedforvalue"0,0,3,0,3,3,0,3,0,0"atpath"coordinates"我的架构如下:varGeoSchema=newSchema({name:String,coordinates:[Number]});GeoSchema.index({coordinates:'2dsphere'});我成功保存的测试点对象:geoPoint=newGeo({coordinates:[2,2],type:'Point'});无法保存的我的测试多边

node.js - 带有自己的 ObjectId 的 Mongoose 自引用抛出 : cast to ObjectId failed

我正在使用nodejs、Mongoose,我试图构建一个shema,其中包含通过父级对自身的引用。Parent应该是对DataType的引用。varDataTypeSchema=newSchema({_id:String,label:{type:String,required:true},comment:{type:String},url:{type:String,required:true},parent:{type:Schema.Types.ObjectId,ref:'DataType'},values:[]});varDataType=mongoose.model('DataTy

json - Mongoose 错误 : Cast to ObjectID failed for value on reading json for db seed

我有一个带有如下引用字段的模型方案:constUserSchema=newmongoose.Schema({//...uf:{type:mongoose.Schema.Types.ObjectId,ref:'UF',index:true},});我的测试数据库种子代码正在使用来自json文件的数据,如下所示:[{"_id":91283,"name":"Testuser","uf":124411923,"version":2}]在种子过程中,模型保存方法后,出现此错误:ValidationError:Uservalidationfailed:uf:CasttoObjectIDfailed