Closed mariorodriguespt closed 9 years ago
Hey @mariorodriguespt hmm, when I originally wrote it I wasn't sure on whether I should throw an error or not, but now considering some of the uses I've seen (now including yours) I'm actually leaning towards not throwing an error by default.
Since this is client side, every second/ms counts on the mobile. wrapping inside a try.. catch()
is a little slower.
@mariorodriguespt as of 3.0 a get call will now no longer throw an error if the collection isn't found https://github.com/dburles/mongo-collection-instances/commit/d79cd7f30edc508028cb25b7d9317e3dbf2e5611
Thanks for the update :D Cheers.
I've a scenario in which it's better to get null, instead of getting an error. I've a scenario in which I've to create client side collections, I'm getting data from the server using _publishCursor. I'm creating the collection on the client with name "context-" + contextId. This packages is really helpful but I've to wrap everything inside a
try.. catch()
.To avoid breaking this package for older users than me, I decided that adding a flag, as the last parameters, make possible updating the package without breaking existing code.
Cheers, Mário Rodrigues