When using sub-fields contents in database are not updated
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
U1DB Qt/ QML |
Incomplete
|
Wishlist
|
Unassigned |
Bug Description
When initially creating a document using the following:
U1db.Document {
id: aDocument
database: aDatabase
docId: 'hello'
create: true
defaults: { "hello": [{"value":"99 Hello Worlds on the wall...
}
The contents in the database contain the following.
{
"hello": [
{
},
{
},
{
}
]
}
This is expected.
However, if and additional entry {"value":"...and so on..."} is added to the default property of the Document, as demonstrated by the following snippet:
defaults: { "hello": [{"value":"99 Hello Worlds on the wall...
... the contents in the database remain the same as above, when they should be updated to:
{
"hello": [
{
},
{
},
{
},
{
}
]
}
If one destroys the database file and adds in the additional entry to the default section as aboce then the database contents reflect the change. But when removing it again and running the application a second time the contents in database does not reflect the omission.
This is what happens:
1. Define a document with defaults
2. The document is added to the database
3. Something *may* modify the document
4. Quit the application
5. New version with changed defaults
6. We can't know if the document's defaults have changed
So this is by design. Unless we special-case default-documents, circumvent the database, add an in-memory document storage, and prevent them from being written unless modified directly.
At the very best I think this is a low priority feature request.