草庐IT

find-euler-circuit

全部标签

mongodb - MongoError : can't find any special indices: 2d (needs index), 2dsphere(需要索引)

我正在尝试通过使用MongoDB的查找方法查询特定点周围的纬度和经度点来使用MongoDB的地理空间索引。我不断收到错误消息:MongoError:can'tfindanyspecialindices:2d(needsindex),2dsphere(needsindex)在谷歌搜索了大约一个小时后,我不确定文档在哪里。我也找不到任何好的解释。这是我使用Mongoose创建的架构:varmongoose=require('mongoose');varSchema=mongoose.Schema;varEventSchema=newSchema({name:String,descripti

MongoDB 外壳 : find by BinData

我在MongoDB中有一个文档,例如{"_id":ObjectId("51723a2f2b9b90e9eb190c45"),"d":BinData(0,"c9f0f895fb98ab9159f51fd0297e236d")}字段“d”已编入索引,但我如何在mongoshell中通过它的值找到它?例如db.test.find({"d":BinData(0,"c9f0f895fb98ab9159f51fd0297e236d")})不工作,知道吗? 最佳答案 Bindata是二进制字符串的base64表示。必须实例化。db.test.fi

r - 长时间使用 mongo.find.all (rmongodb) 导入数据

我尝试使用以下方法将数据从mongodb导入到r:mongo.find.all(mongo,namespace,query=query,fields=list('_id'=0,'entityEventName'=1,context=1,'startTime'=1),data.frame=T)该命令适用于小型数据集,但我想导入1,000,000个文档。使用system.time并在命令中添加limit=X,我将时间作为要导入的数据的函数进行测量:system.time(mongo.find.all(mongo,namespace,query=query,fields=list('_id'

mongodb - Angular2-meteor - 在订阅函数中使用排序的 find() 后变量未定义

我是Meteor和angular2-meteor包的新手,我正在尝试按照此处提供的制作精良的“社交”应用程序教程学习如何使用它们:Sociallyturorial.在试验我在那里看到的有关发布/订阅功能的内容时,我发现了一个我不知道如何解决的问题。为了清楚起见,我用这种结构做了一个非常简单的项目:/typings/test.d.tsinterfaceTest{_id?:string;num:number;}/collections/tests.tsexportvarTests=newMongo.Collection('tests');/server/main.tsimport'./te

python - map_reduce() *和* find() 在同一查询中

我发现了一堆map_reduce教程,但它们似乎都没有“where”子句或任何其他方式来从正在考虑的内容中排除文档/记录。我正在处理一个看似简单的查询。我有一个包含时间戳、IP地址和事件ID的基本事件日志文件。我想在给定的时间戳范围内为给定的事件获取唯一用户数。听起来很简单!我构建了一个类似这样的查询对象:{'ts':{'$gt':1345840456,'$lt':2345762454},'cid':'2636518'}有了这个,我尝试了两种方法,一种使用distinct,另一种使用map_reduce:不同db.alpha2.find(查询).distinct('ip').count

mongodb - 错误 : "could not find implicit value for parameter readFileReader" trying to save a file using GridFS with reactivemongo

我正在尝试使用以下代码在Play2.1中使用reactivemongo保存附件:defupload=Action(parse.multipartFormData){request=>request.body.file("carPicture").map{picture=>valfilename=picture.filenamevalcontentType=picture.contentTypevalgridFS=newGridFS(db,"attachments")valfileToSave=DefaultFileToSave(filename,contentType)valfutur

javascript - meteor 集合 find() 不检索任何数据

我正在学习meteor教程:https://www.meteor.com/tutorials/blaze/collections我定义了一个集合,Tasks=newMongo.Collection("tasks");我向其中添加了两项,一项直接来自meteormongo命令行,另一项使用:Tasks.insert({text:"TestingJS",createdAt:newDate()});以下是在后端运行db.tasks.find()的结果:{"_id":ObjectId("559e9569abbb64fe1d5fd89a"),"text":"Helloworld!","creat

Java -- MongoDB collection.find() by _id

我试图通过使用他的唯一_id从集合中获取元素,但我找不到方法。这是我的代码MongoClientmongoClient=newMongoClient("localhost",27017);MongoDatabasedatabase=mongoClient.getDatabase("DB");MongoCollectioncollection=database.getCollection("COLL");如果我用查询我的数据库BasicDBObjectquery=newBasicDBObject("info.i0","0");DocumentmyDoc=collection.find(q

node.js - MongooseJS 使用 find 通过引用查找

我有这个Mongoose模式。varmongoose=require('mongoose'),dev=require('../db').dev();varschema=newmongoose.Schema({date:{type:Date,default:Date.now},company:{type:mongoose.Schema.Types.ObjectId,ref:'Company'},questionnaire:{type:mongoose.Schema.Types.ObjectId,ref:'Questionnaire'}});module.exports=dev.model

javascript - 为什么 mongodb find() 从来没有得到我的回调

我正在尝试使用mongodb(带有mogoose)和带有restify的node.js构建类似rest的API。我是mongo世界的绝对新手,我不确定问题出在哪里。这是数据库连接的问题还是其他原因?所以,我是这样做的:rest-server.js//startservervarrestify=require('restify');varserver=restify.createServer();server.use(restify.bodyParser());//connectdbvarconfig=require('./Config.js');varmongoose=require(