meteor

comparing dates in mongodb

寵の児 提交于 2019-12-31 04:31:11
问题 A Meteor server code updates a Mongodb collection, dateField has value looking like this ISODate("2016-11-19T00:00:00Z") The client selects a dateStart and dateFinish , look like this $('input[name="startDateStr"]').val() // => "2016-11-19" So I convert the user entry so that I can use it to get the documents with the dateField matching the below mongodb query; dateToISO: (date) => { // date format in YYYY-MM-DD const dArr = date.split('-'); return new Date(parseInt(dArr[0]), parseInt(dArr[1]

How do you provide configuration to MongoDB with Meteor?

﹥>﹥吖頭↗ 提交于 2019-12-31 04:10:10
问题 The meteor command both starts Meteor and MongoDB. How do I have meteor make the equivalent of this command when starting MongoDB mongod --profile=1 --slowms=1 ? Alternatively, is there a .conf file for mongo someplace that meteor uses? 回答1: I had a quick search through the source and I don't see an obvious way that one could pass additional arguments to the mongod started by meteor in development mode. My recommendation would be to start a separate mongod on your system with those arguments

In Meteor, how do I know on the client-side when the server-side operation is done?

荒凉一梦 提交于 2019-12-31 03:21:06
问题 I know Meteor does client-side caching of the database for better effective performance. In the client-side Meteor method call, is there any way to know when the server-side database operation actually finishes (or if it actually failed)? Are there events I can hook into to get notification when the full remote procedure call finishes? Is there some way to use subscribe() to know when this particular call "really" finishes? For example, from the simple-todos tutorial, is there a way to get

Flow Router doesn't work with ObjectID. Any fix?

人走茶凉 提交于 2019-12-31 02:25:13
问题 I'm trying to build routes in my Meteor app. Routing works perfectly fine but getting information from db with route path just doesn't work. I create my page specific routes with this: FlowRouter.route('/level/:id'... This route takes me to related template without a problem. Then I want to get some data from database that belong to that page. In my template helpers I get my page's id with this: var id = FlowRouter.getParam('id'); This gets the ObjectID() but in string format. So I try to

MeteorJS: How to get clicked element

倖福魔咒の 提交于 2019-12-31 02:13:24
问题 I'm trying to get the clicked element so that I can add class. Does Meteor provides any way to get the current element like jQuery $ (this) Template.retraining.events({ 'click .myclass': function (event) { //Get the clicked element like $(this) in jQuery $().addClass('existing-col'); } }); 回答1: To get the element on which the event occurred, use event object. event.target As you've jQuery included, you can wrap the element in jQuery to use jQuery methods on it. $(event.target) You can see

How do you access attributes of an object queried from Mongo in Meteor

微笑、不失礼 提交于 2019-12-31 01:05:41
问题 I'm pretty new to mongo in the Meteor.js framework. Here, I've queried a MongoDB object using it's ID. I'm trying to access an attribute "mana" but it returns me undefined. var skill = Skills.find({_id:Session.get("selected_skill")}); alert(skill);//This returns me "undefined" Skills.update(Session.get("selected_skill"), {$inc: {mana: 1}}); Could you enlighten me on the requirements of accessing attributes in mongo for meteor? Thanks 回答1: find method returns a cursor, not object nor array. To

Mocha-web client-side tests not running with Velocity for Meteor application

旧街凉风 提交于 2019-12-30 23:25:31
问题 I have 2 samples Mocha web tests which I'm trying to run using Velocity. For some reason, client-side tests under the /tests/mocha/client folder are never executed, whereas the server side tests under the /tests/mocha/server folder run fine. Here is the structure of my project todos (meteor example project) client lib packages server tests mocha client server Thoughts ? 回答1: I ran into this problem and it was related to having the browser-policy package installed. What you need to do is look

How to investigate “Exception form Deps recompute” what are the clues?

那年仲夏 提交于 2019-12-30 22:57:18
问题 I am on a big project, first exposure to Meteor, and I am starting to get this very often. It will be hard to trace it back to a particular commit, as it seemed intermittent. What is a fruitful way to approach finding the problem? Is there anything in the exception that helps narrow it down? How do I step through/set breakpoints in/rule out the Deps? All my deps are the auto ones from mongo operations, or one on a session var, nothing explicit. Thank you https://gist.github.com/jimmack1963

Calling a function in Meteor.method returns undefined

本秂侑毒 提交于 2019-12-30 14:42:21
问题 I've been trying for the past few days to get a return object from a Meteor method. Every time I do this I get undefined on the client. Meteor.methods({ 'CORSTest' : function() { let url = "www.theverge.com/2017/4/13/15270854/nasa-enceladus-ocean-hydrothermal-vents-alien-life-conditions-cassini-saturn"; og(url, function(err, meta){ if(err){ console.log(err); return "Error"; } else { console.log(meta); // Returns the correct Object on the server return meta; } }) }, }) I've been going crazy

Calling a function in Meteor.method returns undefined

岁酱吖の 提交于 2019-12-30 14:41:00
问题 I've been trying for the past few days to get a return object from a Meteor method. Every time I do this I get undefined on the client. Meteor.methods({ 'CORSTest' : function() { let url = "www.theverge.com/2017/4/13/15270854/nasa-enceladus-ocean-hydrothermal-vents-alien-life-conditions-cassini-saturn"; og(url, function(err, meta){ if(err){ console.log(err); return "Error"; } else { console.log(meta); // Returns the correct Object on the server return meta; } }) }, }) I've been going crazy