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
{{ message }}
Repository navigation
Collection table data not showing updated when editing mongo directly #4501
The fields are updated correctly when looking at the edit form for that collection item, but the data is showing the previous value when looking at the list of collection items.
Is there some extra step I need to take to fully commit that change?
Okay, since you mentioned you have versions enabled, I know what is going on.
The list view is displayed by querying a secondary collection that is named from your collection slug, prefixed with _versions_, so _inventory_versions in your case. Only published documents end up in the natural db collection and this is not the data that is used in the list view.
You might want to update inventory using the Paylaod local API, you will have to read and update the document to increment the stock in code. The upside is that your versions will be updated in the database as one might expect.
If you don't care about maintaining the version history of the stock value specifically, you could maintain both collections versions and collection how you have done it. You can access the latest version for a document by querying on the latest: {$eq: true} and you can get the version collection from: payload.db.versions.inventory.
I am going to convert this issue to a discussion since there isn't anything to fix at this time.
Activity
DanRibbens commentedon Dec 13, 2023
Okay, since you mentioned you have versions enabled, I know what is going on.
The list view is displayed by querying a secondary collection that is named from your collection slug, prefixed with
_versions_, so_inventory_versionsin your case. Only published documents end up in the natural db collection and this is not the data that is used in the list view.You might want to update inventory using the Paylaod local API, you will have to read and update the document to increment the stock in code. The upside is that your versions will be updated in the database as one might expect.
If you don't care about maintaining the version history of the stock value specifically, you could maintain both collections versions and collection how you have done it. You can access the latest version for a document by querying on the
latest: {$eq: true}and you can get the version collection from:payload.db.versions.inventory.I am going to convert this issue to a discussion since there isn't anything to fix at this time.