CPU usage is going up

Correct, you would want to create a compound index, something like this

 x: 1,
 y: 1,
 last_activity: 1

Let me know if that helps

If you are using Blaze, create a template helper
I think that way, it will be reactive.

Where is this code you posted, the client? An index will only help server side. If you publish/subscribe in the standard way, the client should see reactive updates to the collection via the reactivity of the cursor returned by find on the client

Sorry, this code is indeed server side. The server calculates a players X and Y, and pushes back data between an X and Y value. Simple video game logic.

The file is /imports/posts.js wrapped in an Meteor.isServer{

Question: If the value of X and Y are changing all the time, up to 1 time per second, I can still index for performance gains yes?

Sure am!

I’ve got the template helper, but for some reason it doesn’t get new data. Perhaps it’s a simple mis-configuration. I’ve put it off exploring for a while until I got other bugs and deployment server worked out; revisiting now. I’ve learned so much!

Great vid on indexing,

1 Like

Your linode has probably been compromised since they don’t set you up with SSH keys initially. Had this a few times!