I have a bit of a strange issue that I can’t seem to get my head around…
I am trying to update a doc, but when I have a client open and subscribed to that collection, the update succeeds (either from method call or from mongo shell - no errors) but the data change doesn’t persist.
If I browse to another page in the app and try the update from the shell again, the change does persist.
I thought it might be schema related, but the only schema I have set for that collection is on a different method. Just in case that was causing weird issues, I commented out anything to do with that method and restarted the app… Issue still happening…
Is there something with Simpl-schema that persists even between app restarts? And is a simpl-schema attached to a single method then applied all the time for that collection?
A schema is the structure of your collection and determines what is a string, a boolean, an object, an array and so on.
You always have a schema - in your case it’s implicitly defined by what you insert into the collection. That’s why your query fails: You’re running afoul of your implicit schema.
(Granted: With NoSQL databases it’s perfectly possible to have ambiguous or chaotic schemata - but in that case you’re probably a fool and deserve all the pain this brings That’s actually one of the advantages of SQL databases: They may not be as flexible but at least you always know what’s what)
Okay, that’s weird. What does your publish function look like?
Also, if you change the value through meteor mongo what does the document look like immediately after the change when you query it through mongo shell?
But - If I browse to a different page on the app and do the exact same command, it does update on the backend updating through the shell.
So something about a client being on a specific page on the client is seemingly causing a weird backend issue. So maybe it is pub/sub related I don’t know.
If I run an update to a different field of the same document it works perfectly. For example:
This has the feeling of a bug to me (although I don’t know enough to say for definite), just because it’s a very specific thing that is failing. When connected to a specific page, updates to an entry level array work fine, but updates to a nested array do not. The same updates work fine when not connected to that specific page so the update syntax is fine.
Is there anyone from MDG that might be able to help? Is there a way to flag or report these types of things?
Ok here’s where it gets even crazier. The broken page has tabbed views (controlled through react state). When viewing a different tab (same page route, subscriptions etc), I can do the update on the backend.
How the hell react state is dictating DB calls I have no idea. Now I’m well and truly stumped