草庐IT

mongodb.driver

全部标签

mongodb - 无法启动 mongodb 服务 :/data/db not found

我在openSUSETumbleweed上使用MongoDB3.6.2。今天当我尝试打开mongoshell时出现连接错误。当我使用检查mongodb.service的状态时sudosystemctlstatusmongodb显示Active:failed没有太多有用的信息。然后我检查了sudomongod--repair我发现了以下错误:STORAGE[initandlisten]exceptionininitAndListen:NonExistentPath:Datadirectory/data/dbnotfound.,terminating于是我去查看我的/etc/mongodb

java - 在不转换为列表的情况下在 MongoDB 中存储 float 数组

我正在尝试在MongoDB中存储一组float。这是我尝试做的示例:floatfloatArray[]={1,2,3,4.....,10000};MongoCollectioncollection=database.getCollection(XMLUtils.getDatabaseCollectionName());Documentdoc=newDocument("_id",edgeId).append("floatArray",floatArray);collection.insertOne(doc);但这会引发错误:org.bson.codecs.configuration.Co

java - MongoDB 存储库 - 如何注释不是文档的子类?

我有2个类:@Document(collection="student")publicclassMongoStudent{@IdprivateBigIntegerid;@Field("name")privateStringname;@Field("lname")privateStringlname;@Field("studium")privateListstudium;@PersistenceConstructorpublicMongoStudent(BigIntegerid,Stringname,Stringlname,Liststudium){this.id=id;this.nam

mongodb - 如何通过 FIWARE Cygnus 与 MongoDB 存储分层数据

我已经部署了一个FIWARE配置来接收来自TheThingsNetwork的MQTT消息。该配置使用IoTAgent-JSON、Orion和Cygnus,以及用于Cygnus的MongoDB后端。消息已正确保存到MongoDB。不幸的是,消息数据具有层次结构,消息的某些部分在MongoDB中显示为字符串,而不是嵌入的子文档。这使得查询数据变得困难。详情如下:消息格式由TTNMQTTDataAPI定义.我在Orion上定义了一个实体类型,如下所示:curlhttp://localhost:1026/v2/entities-XPOST-H"content-type:application/

javascript - mongodb nodejs - 转换循环结构

我有一些代码可以从集合中提取所有文档并将其放到网页上。简化版本如下所示:varmongodb=require("mongodb"),express=require("express"),mongoServer=newmongodb.Server('localhost',27017),dbConnector=newmongodb.Db('systemMonitor',mongoServer),db;varapp=newexpress();app.get('/drives',function(req,res){db.collection('driveInfo',function(err,c

mongodb - 返回满足子查询结果集的文档

我正在尝试解决在SqlServer中需要公用表表达式或子查询的问题。我有一个名为Invoice_Details的集合。每个文档都有一个InvoiceID、CustomerID、TransactionDate和TransactionAmount字段。我想要做的是取回当TransactionAmount聚合时不等于零的所有文档。我正在做如下分组:db.Invoice_Details.aggregate([{$group:{_id:{InvoiceID:"$InvoiceID"},Balance:{$sum:"$TransactionAmount"}}},{$match:{Balance:{

mongodb - 排序多个条件MongoDB

我有用户的集合,这是以下文件:{"_id":1,"name":"A","online":1,"like":10,"score":1},{"_id":2,"name":"B","online":0,"like":9,"score":0},{"_id":3,"name":"C","online":0,"like":8,"score":1},{"_id":4,"name":"D","online":1,"like":8,"score":0},{"_id":5,"name":"E","online":1,"like":7,"score":1},{"_id":6,"name":"F","onli

mongodb - org.bson.codecs.configuration.CodecConfigurationException : Can't find a codec for class org. springframework.data.mongodb.core.query.GeoCommand

我正在使用如下聚合:finalListaggregations=newArrayList();Polygonpolygon=newPolygon(newPoint(-26.28125,42.19231862526141),newPoint(100.28125,64.7157757187955),newPoint(100.28125,42.19231862526141),newPoint(-26.28125,64.7157757187955));AggregationOperationmatch=newMatchOperation(Criteria.where("location").w

mongodb - 如何在 docker-compose 之后运行 Mongo shell 命令?

我想启动这个MongoDB副本集:version:"3"services:mongo1:image:mongoports:-27017:27017command:mongod--replSetrs0mongo2:image:mongoports:-27018:27017command:mongod--replSetrs0mongo3:image:mongoports:-27019:27017command:mongod--replSetrs0等待它们出现,然后通过终端访问Mongoshell:dockerexec-itmongo1mongo然后在Mongoshell中执行:rs.ini

java - 如何避免使用 Spring-Boot 下载嵌入式 MongoDb

在我的项目中,我使用了spring-boot和嵌入式MongoDb,查看我的pom.xml文件:4.0.0com.defaultdefault0.0.1-SNAPSHOTjardefaultDemoprojectforSpringBootorg.springframework.bootspring-boot-starter-parent2.0.1.RELEASEUTF-8UTF-81.7truede.flapdoodle.embedde.flapdoodle.embed.mongo1.50.5cz.jirutka.springembedmongo-springRELEASEorg.sp