You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The behaviour around reference fields has become a bit muddy. Go through the entire app and the MongoDB driver to ensure all reference fields behave as advertised, and make sense code-wise.
The text was updated successfully, but these errors were encountered:
Reference fields should not be implied; they must be explicitly set in the model, complete with the collection they refer to
Each field should be able to contain n number of references
MongoDB can handle this natively as an array
Drivers for less flexible relational databases may need to abstract away a relations table
GET /data
In the returned data, each reference should be expanded to the corresponding object
There should be a hard limit on how many levels will be expanded (3? 10?)
Also a way to detect and prevent recursive references
By default, always return an array of objects. Add a single key for the model if the user wants to force a direct object
In filtering in URL patterns, only filtering by the stored IDs needs to be supported. CSV of IDs should be treated as an OR
POST /data
If the posted value for the reference field is a string, or an array of strings, assume it's an object ID
In strict mode, return an error if it's not a valid ID
If the posted value is a (JSON) object, or an array of objects, create a new entry based on the values
Need to guard against a POST request with multiple reference fields, where the first one succeeds, but the second one fails validation; this should not result in a situation where the overall request fails, but that one straggler entry is retained in the referenced collection
Surface a config value for max number of records created on the fly via a reference field, with a sensible default
When modifying an existing record, overwrite any existing value with whatever is sent, if it's sent
Dropped references should not result in deleted records
DELETE /data
Records to be deleted can be filtered the same as above
Referenced records should not be deleted automatically
The behaviour around
reference
fields has become a bit muddy. Go through the entire app and the MongoDB driver to ensure all reference fields behave as advertised, and make sense code-wise.The text was updated successfully, but these errors were encountered: