草庐IT

meteor-collections

全部标签

mongodb - 在 MongoShell : Not able to connect to my collection, db.collection_name 返回 NaN

我使用的是MongoDBEnterprise,MongoDBshell版本:3.2.5我有一个db=mydb和一个collections=['events','events__2015-12-01','events__2015-11-01']我有一个python/pymongo脚本,我可以在其中连接到每个文档,但在mongoshell中我无法连接到过时的集合?换句话说mongodb>usemydbswitchedtodbmydbmongodb>db.eventmydb/eventmongodb>db.event__2015-12-01NaNmongodb>db.event__2015-

javascript - 如何使用MongoDB在Meteor中连续发布最新的N条记录?

我有一段代码每30秒将天气信息存储到MongoDB集合中。我想出了一种方法,将最近24小时的数据从服务器发布到客户端,如下所示:服务器Meteor.publish('mountCarmelData',functiondataPublication(){returnMountCarmel.find({},{limit:2880//maxof24hours});});客户端Meteor.subscribe('mountCarmelData');如果插入一条新记录并且集合中的记录总数小于限制,则这条新记录会自动发送到客户端。问题是当集合中保存的记录超过2880条时,新记录不再发送到客户端。我

mongodb - Meteor 发布或订阅在应该只返回一个对象时返回一组对象

我正在尝试发布一个发布,它返回代码属性等于用户selectedGroup的组。Meteor.publish('selectedGroup',function(){returnGroups.findOne({code:Meteor.users.findOne(this.userId).profile.selectedGroup})})订阅看起来像这样Meteor.subscribe('selectedGroup')return{group:Groups.find({}).fetch()}但我得到的是用户所属的所有组的数组,而不是发布应返回的组。即使我执行findOne(),它也会返回第一

node.js - TypeError : db. collection.createIndex 不是快速项目搜索功能中的函数

使用下面的代码我得到错误TypeError:db.collection.createIndexisnotafunction,我想用它来实现来自这个站点的搜索功能:https://docs.mongodb.com/manual/text-search/也许有其他方法可以搜索MongoDB?app.post('/search',function(req,res){varresults=[];mongodb.MongoClient.connect(url,function(err,db){db.collection.createIndex({Name:"text",Code:"text"})

mongodb - 如何通过 mup 更改 meteor 部署中的 mongo 端口?

我有带有文件mup.js的meteor应用程序。而mongo数据库的端口同样设置为27018。module.exports={servers:{...},meteor:{...env:{PORT:3000,ROOT_URL:'http://app.com',MONGO_URL:'mongodb://localhost:27018/meteor',},docker:{image:'abernix/meteord:base',imagePort:9090,//(default:80,someimagesEXPOSEdifferentports)},...},mongo:{port:2701

mongodb - Meteor find().fetch() 与多个条件不工作

我正在尝试从约会表中获取一些数据。但是当执行下面的代码时,没有获取数据。在我的mongo中,我有符合条件的数据。任何帮助将不胜感激。任何人都可以检查我给出的条件是对还是错。vartimePeriod={to:1512412200000,from:1511807400000}varList=appointment.find({$and:[{‘appointmentDate’:{$gte:Number(timePeriod.from)}},{‘appointmentDate’:{lte:Number(timePeriod.to)}},{‘url’:{$eq:‘boaseenterprise

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集合。

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

node.js - 蒙戈/ express : How to return all documents in collection if no query params are passed?

如果没有传递查询参数,我将尝试从我的Mongo集合中返回所有文档。目前我有3个可选的查询参数可以由用户传递。localhost:3000/api/projects//shouldreturnallprojects.Currentlythisisreturning[]localhost:3000/api/projects?id=1//shouldreturnprojectswithidof"1".Workingproperly.localhost:3000/api/projects?name=myproject//shouldreturnprojectswithnameof"myproj

python - Flask-PyMongo : how come "self._Collection__database"?

在Flask-PyMongo中,他们使用self._Collection__database来表示这个Collection对象所属的数据库对象:classCollection(collection.Collection):"""Customsub-classof:class:`pymongo.collection.Collection`whichaddsFlask-specifichelpermethods."""def__getattr__(self,name):attr=super(Collection,self).__getattr__(name)ifisinstance(att