草庐IT

mongodb.driver

全部标签

mongodb - 未找到 meteor 方法 '/users/insert'

我正在尝试使用以下方法将文档插入到MongoDB中import{Users}from"../../api/users/collection";Users.insert(UserInfo);但我收到此错误消息“找不到方法‘/users/insert’”我在这里创建集合:import{Mongo}from"meteor/mongo";exportconstUsers=newMongo.Collection("users");我在名为“users”的服务器端使用Robo3t创建了用户集合使用此设置我可以.insert()与其他集合,但不能与新创建的Users集合。

c# - 尝试并发更新(AddToSet)到 mongodb 中的集合并且它不能正常工作

我有FileAggregateReport类:publicclassFileAggregateReport{publicGuidFileId{get;set;}publicGuidCorrelationId{get;set;}publicintNumberOfSupportedEngines{get;set;}publicintEnginesCompleted{get;set;}publicstringSHA256{get;set;}publicDateTimeScanDate{get;set;}publicListEngineReports{get;set;}}我正在尝试添加到列表E

javascript - 要更新 MongoDB 文档中的单个字段,最好的方法是什么? feathersjs 中的更新或补丁 Hook

我尝试在单个字段中更新mongodb文档,我怀疑我想使用哪种方法使用补丁或更新使用羽毛框架,请举例说明我们如何做到这一点。const{authenticate}=require('feathers-authentication').hooks;module.exports={before:{all:[authenticate('jwt')],find:[],get:[],create:[],update:[],patch:[],remove:[]},after:{all:[],find:[],get:[],create:[],update:[],patch:[],remove:[]},

mongodb - Spring data mongodb 没有找到 java.util.Date 聚合管道结果的映射元数据

由于aggregation管道,我一直在为java.util.Dateexception找到Nomappingmetadata,这里是代码:型号:publicclassModel{//...privateListdateValues=newArrayList();//setterandgetters}publicclassDateValue{privateDatedate;privateBigDecimalvalue;//setterandgetters}然后我有一个自定义存储库实现,如下所示:模型库实现:publicclassModelRepositoryImplimplements

mongodb - mongo atlas 或 aws - 内部或外部连接

我目前正在开发我的下一个项目,该项目100%在mongo上运行,我过去的项目是在SQL+Mongo上工作的,我在上面使用了AWSRDS+AWSEC2,并且可以在AWS内部IP中连接它们,这使我的连接速度更快。现在在mongo中有很多花哨的云服务器,例如MLab和MongoDBAtlas,实际上比AWS便宜。我担心的是,与RDS中的内部连接相比,移回外部数据库连接会更慢且网络消耗更多有没有人遇到过这样的问题?也许差异没有我做的那么大,但我需要对其进行优化 最佳答案 这取决于您的设置。许多“花哨的”服务也在AWS上托管内容,因此延迟很小

node.js - mongodb nodejs db.collection 不是函数

这是我的FollowerModel类(在ES6中)代表我的MongoDB的follower集合importmongofrom'mongodb';classFollowerModel{constructor(db,logger){this._db=db;this._logger=logger;}asynccreate(data){try{data._id=mongo.ObjectID().toString();returnawaitthis._db.collection('follower').insertOne(data);}catch(error){returnPromise.rej

java - 连接到 MongoDB Atlas : com. mongodb.MongoCommandException: Command failed with error 8000

因此,我正在尝试连接到托管我的数据库的MongoDBAtlas服务(我过去曾毫无问题地这样做过),但我一直收到此错误,我不明白为什么。我找不到有同样问题的人,所以我很困惑。Exceptioninthread"main"com.mongodb.MongoCommandException:Commandfailedwitherror8000:'notauthorizedonadmintoexecutecommand{insert:"adminCol",ordered:true,documents:[[{_idObjectIdHex("5a4e3b6dd04f1c047975fdd5")}{

arrays - 在同一文档 MongoDB 中将一个元素从一个数组移动到另一个数组

我有这样的数据:{"_id":ObjectId("4d525ab2924f0000000022ad"),"array":[{id:1,other:23},{id:2,other:21},{id:0,other:235},{id:3,other:765}],"zeroes":[]}我想从一个数组中$pull一个元素并将其$push到同一文档中的第二个数组,以产生如下所示的结果:{"_id":ObjectId("id"),"array":[{id:1,other:23},{id:2,other:21},{id:3,other:765}],"zeroes":[{id:0,other:235}

MongoDb - 聚合 : How to get Grand Totals with Individual, 未分组记录?

假设我们有这样的文档:{type:"hourly",amount:100},{type:"flat",amount:350},{type:"hourly",amount:200},{type:"payment",amount:100},{type:"payment",amount:200}在管道的某处,我想为每个“类型”累积总计。连同所有个人记录,我想知道我们的总计如下:hourly:$300flat:$350payment:$300我查看了$add和$sum,它们似乎对为给定记录添加字段很有用,但对累计总计没有帮助。到目前为止,我的聚合过滤了我想要的所有记录并且没有使用分组。我不想对

mongodb - 通过 _id 在 mongodb 数据库中的对象数组上查找

我正在尝试在对象数组中查找对象的ID。该_id与文档中的其他字段具有相同的字段名称_id。这是我的模型(简要)varCardSchema=newmongoose.Schema({beName:String,beLink:String,cards:[{cardType:String,cardBundle:String}]这是我的数据库内容的示例_id:ObjectId(5a52540638086448bf4235e8)beName:Name1beLink:Link1cards:Array0:ObjectcardType:type1cardBundle:1_id:ObjectId(5a52