Comments (2)
Probably isn't feasible to observe just anything... maybe just tie autoValue in to relationships in issue #31 so it can recalculate every time a related object changes/inserts/deletes.. that would cover most use cases of autoValue when looking for a precalculated "virtual field."
from meteor-collection2.
I might not be thinking everything through, but it seems like there are a number of other ways this could be handled:
sales
could be a virtual field. The calculation would be done more often than necessary, but it would work.- You could allow updating
sales
from the server only and then do a server-side observe on anInvoices.find()
cursor, which would updatecustomer.sales
wheneverinvoice.total
changes. (Haven't tried the specifics, but it seems like it would work. It's similar to what you're suggestingallowObserve
should do.) A while ago I had the idea to add aserverOnly: true
option to schemas, but there was never a great use case, but maybe something like this is one. You can do it manually in adeny
function, though.
In general the idea of using autoValue
to enforce a particular value based on another collection is something I haven't thought much about, but I feel like it's perhaps overkill since there is custom observe
and other ways to accomplish it. Nevertheless, I can see where one might expect autoValue
to be able to do that, so it's something to keep in mind.
You're correct also that it might tie in with relationships development eventually. Maybe some way of defining a related field as a "count" or "sum" field.
I'll have to think about this.id
, too. Since I'm not yet convinced this is a good use of autoValue, I'm also not yet convinced that this.id
is necessary.
from meteor-collection2.
Related Issues (20)
- Upsert no longer works in 3.0.5
- Duplicate key errors not correctly reporting (no Meteor.Error) HOT 3
- Migration from Meteor 1.4 to 1.9, Collection 2 from 2.10 to 3.0, SimpleSchema with meteor-collection2 error on unique option HOT 3
- Can't update the collection HOT 3
- Dynamic Schema with Validation HOT 10
- Is it possible to create field type that takes key and value pair? HOT 4
- Writing a robust updatedAt autoValue HOT 4
- CONTRIBUTING.md is missing HOT 1
- Breaking change in v3.2.0 for extending schemas HOT 2
- Delete the name of collections in error messages HOT 5
- Question: A way to log all errors without actually throwing them? HOT 1
- Does not work with `$[]` positional operator HOT 1
- relplace lodash with underscore HOT 3
- FLE-Encryption HOT 3
- Expose defaultCleanOptions HOT 10
- Apply `defaultValue` on `fetch` HOT 6
- Stub exceptions are logged instead of thrown in Meteor Methods, preventing throwStubExceptions from working as intended
- Meteor 3.0 potential bug HOT 6
- 4.0 load function is not dynamic HOT 2
- Insert with 'bypassCollection2: true' throws an exception HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meteor-collection2.