meteor

Count number comments in post in Meteor

帅比萌擦擦* 提交于 2019-12-29 09:35:10
问题 If I want to count the number of comments a post has got, I will have to save the number of comments every time a new comment is either created or removed. What is the most efficient and secure way to ensure the posts are updated with the number of comments every time a comment is either created or removed? I have tried Curser.observe() but it seems it causes some problems sometimes. I have looked through my code and it should be OK but sometimes some changes happend when they shouldn't so I

Meteor mongo updating nested array

三世轮回 提交于 2019-12-29 08:54:27
问题 Example document: { "_id" : "5fTTdZhhLkFXpKvPY", "name" : "example", "usersActivities" : [ { "userId" : "kHaM8hL3E3As7zkc5", "startDate" : ISODate("2015-06-01T00:00:00.000Z"), "endDate" : ISODate("2015-06-01T00:00:00.000Z") } ] } I'm new in mongoDB and I read other questions about updating nested array and I can't do it properly. What I want to do is to change startDate and endDate for user with given userId. My problem is that it always pushes new object to array instead of changing object

How would you find a collection dynamically in Meteor with a value?

被刻印的时光 ゝ 提交于 2019-12-29 07:15:23
问题 Given I have 3 types of collections and a dynamic value, how would I specify what collection to search for based on that dynamic value? E.g, array = [ {id: 'one', type: 'profile'}, {id: 'something', type: 'post'}, {id: 'askjdaksj', type: 'comment'] ] How would I isolate the type and turn it into a collection? Basically turning type into Collection.find array[0].type.find({_id: id}); => Profiles.find({_id: id}); Is this possible? 回答1: Here's a complete working example: Posts = new Mongo

Meteor Accounts.ui.config not working with Google

二次信任 提交于 2019-12-29 07:01:30
问题 I am simply trying to log in with Google and get the permissions for Calendar, etc. However, my code in the client only prompts user signing in for offline access. Why is it not asking for the calendars, etc.? Also, it is not forcing the approval prompt. I'm using ian:accounts-ui-bootstrap-3 Accounts.ui.config({ requestPermissions: { google: ['https://www.googleapis.com/auth/calendar', 'https://www.googleapis.com/auth/calendar.readonly', 'https://www.googleapis.com/auth/userinfo.profile',

Can mongorestore take a single url argument instead of separate arguments?

こ雲淡風輕ζ 提交于 2019-12-29 06:54:09
问题 If I have a mongo database URL of the following format mongodb://someUsername:somePassword@some.server.com:27017/some_collection Is there an easy way to give this to mongorestore without having to do mongorestore -u someUsername -p somePassword -h some.server.com:27017 -db some_collection /path/to/dump The reason I ask is because meteor mongo --url gives back a url of that form (and it looks like a standardized url format) but it expires in one minute. Because the password and host can be

Meteor application - Stuck at “Starting your app” when trying to run

断了今生、忘了曾经 提交于 2019-12-29 06:25:32
问题 I have a Meteor 1.3.1 project and I try to run in IntelliJ Webstorm on Windows 10. The problem is that when I run my application everything works fine up until all the packages are loaded, then the program gets stuck at "Starting your app". So I get the " Started proxy " message and all the packages load properly. I can also mention that I have a Macbook on which the project runs just fine. So it feels like the problem is related to some configuration on my Windows machine... The image below

How to config Meteor on AWS/EBS using METEOR_SETTINGS environment variable

旧城冷巷雨未停 提交于 2019-12-29 04:23:08
问题 Trying to set up a Meteor on an AWS/EBS (Amazon Web Services, Elastic Beanstalk) environment. A Meteor dev-run can be passed a command line flag: --settings settings.json where settings.json is a file containing server/client key/value configs (as properly-formatted JSON). Instead of passing the config file in command line, Meteor's deployment uses a METEOR_SETTINGS environment variable. If provided it is expected to contain a json document such as contents of settings.json , for example: $

Meteor Pagination Issue

ⅰ亾dé卋堺 提交于 2019-12-29 02:14:28
问题 I am having issues with pagination I've implemented. Pagination works based on server-sided publish skip & limit filter. Issue #1. If I perform a specific user search the very first page will be blank. At that state skip is set to 0, limit is always 20. If I perform a find().fetch() I get 20 elements, but they are all for a different user. Issue #2 Me going to next page (skip+10) gives me a few more elements Doing it again gives even more results and finally being out of data, and going to

Meteor: How to render line breaks?

做~自己de王妃 提交于 2019-12-28 23:56:47
问题 I have the following variable: "hello↵↵world". (the value is coming from a textarea) The problem is when I ask Meteor to display it with {{content}}, everything appears on the same line and the line break are not taken into account. {{content}} # renders hello world # should render hello world 回答1: Wrap with <pre> Any amount of formatting. </pre> 回答2: If you're using bootstrap using the <pre> tag will come with some style that you probably don't want... If you want to avoid that you can solve

Is there a way to tell meteor a collection is static (will never change)?

a 夏天 提交于 2019-12-28 18:05:46
问题 On my meteor project users can post events and they have to choose (via an autocomplete) in which city it will take place. I have a full list of french cities and it will never be updated. I want to use a collection and publish-subscribes based on the input of the autocomplete because I don't want the client to download the full database (5MB). Is there a way, for performance, to tell meteor that this collection is "static"? Or does it make no difference? Could anyone suggest a different