-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Counts.get() delivers zero even though MongoDb console and server show count > 0 #75
Comments
Try this example
Do you still get zero for both? If not, then I think you fell victim to asynchronicity. IIRC, If I'm right on this, you might try another example that is reactive.
|
Thanks @boxofrox for your effort to help. Your example didn't work either but I made an interesting observation (which I don't understand but you and others might do). I added a record to Gedmatches collection via the browser console. Then I checked the total number of records of Gedmatches and it still showed 0 in the browser console. Then I checked the same in the MongoDb shell and voila, the newly inserted record is there, increasing the total number by one and I was able to find it as well. So it's not a reactivity problem, it rather seems that the collections aren't shared at all with the Mini-mongo (again, for reasons that I don't understand). Hopefully this helps you and you can point me in the right direction. |
You do seem to have the wierdest problems with Meteor. I've no idea what's going on here, so let's begin. When you ran your browser record test, did you...
Can you generate a small meteor app that reproduces this behavior and publish it in a gist/repo, so I can reproduce the problem myself? I'll see if I can generate a meteor app based on your first example, and see what happens. |
Yes, I'm producing weird problems in Meteor. Now for your questions: A1) The As far as reproducing the problem in a small app that will take some time and thinking. It's not part of a huge backend app and I just started to work on the frontend part. FYI I'm using Meteor version 1.1.0.3 (if that's important, have to as WebStorm still has problems with Meteor version 1.2) Your methodological approach to solve the problem is appreciated a lot, if only everyone who created a package would even show half of that effort (I'm getting the runaround by a company dev in another package issue)! |
All appears to be in order then. These examples should still work with Meteor 1.1.0.3. I posted an example gist. It mimics the Here's how to run it:
The app has 3 identical collections (ThingsA, ThingsB, ThingsC). They differ only in the method used to populate them which is described in the notes column of the app webpage. Stop & start the meteor server to change ThingsA. Use the in page buttons to adjust ThingsB or ThingsC. Each time a record is inserted, a random status of The app displays the counts of all Running While the records are not accessible, I use I've tested this on 64-bit Linux with the Chromium web browser. Give that a try and let me know if it works for you. If it doesn't, then I suspect something is wrong with your dev environment. |
It works like a charm, wow! Actually your approach of only keeping the collection ThingsA on the client (via not publishing) is much better as it save a lot of memory in the browser (my collections will get very big once it's running with more users). BTW, I will take a close look at your code and see how I can re-write mine. One thing I noticed already is that you put the pubs under the Meteor.startup function. That's different from my code, not sure if that has any implications (it means the pub is executed last in your example, right?) What I don't yet understand is how you get from You've lost me here, guess some debugging is in order. Many thanks for setting this up and also your help on the other mdbutton issue! |
Oops. I meant
That part's a bit convoluted and what I think of as spacebars magic. Spacebars appears to have very narrow scope (what code is visible to templates) and its docs speak of a data context which is similar to the
|
Autopublish package is removed. Here's the code in counts.html:
Output in the browser console is:
Number of jobs completed (client): 0
Number of atDNA matches (client): 0
Whereas the same query:
executed on the server (and in Mongodb shell) gives:
Number of jobs completed (server): 207
Number of atDNA matches (server): 51
I'm not sure what I'm doing wrong, tried to copy everything from the documentation. FYI - A normal find with a pub for all records (without further filter) find all records and works.
Thanks in advance for your help!
The text was updated successfully, but these errors were encountered: