-
-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ErrDocumentIfNotAttached occurs when trying to remove documents in Dashboard #758
Comments
Good, may i try this issue? |
This commit addresses the issue where documents attached to a client are not being properly detached during deactivation. Specifically, information about document detachments are not being reflected in the database, leading to situations where documents remain attached to a deactivated client. By this fix, attempting to delete a document from the dashboard will now correctly handle the scenario where the document is attached, resolving the problem outlined in issue #758. --------- Co-authored-by: Youngteac Hong <[email protected]>
This issue occurred because the document was not properly detached when the client was deactivated. This has been modified in #907 to ensure that document detachment is correctly reflected when deactivating a client. After these modifications are applied, correction logic is required for clientInfos with deactivated status that already have attached documents. Through the query below, you can search for documents that meet the conditions and perform modifications on each. db.clients.find({
status: 'deactivated',
documents: { $ne: null },
$expr: {
$gt: [{
$size: {
$filter: {
input: { $objectToArray: "$documents" },
as: "doc",
cond: { $eq: ["$$doc.v.status", "attached"] }
}
}
}, 0]
}
}).forEach(doc => {
var updatedDocuments = {};
for (var key in doc.documents) {
if (doc.documents[key].status === 'attached') {
updatedDocuments[key] = {
status: 'detached',
client_seq: 0,
server_seq: 0
};
} else {
updatedDocuments[key] = doc.documents[key];
}
}
var currentTime = new Date();
db.clients.updateOne(
{ _id: doc._id },
{
$set: {
documents: updatedDocuments,
updated_at: currentTime
}
}
);
}); |
This was fixed by #907 |
What happened:
ErrDocumentIfNotAttached
occurs when trying to remove documents in Dashboard.What you expected to happen:
A document should be removed if it is not attached to clients.
How to reproduce it (as minimally and precisely as possible):
Try to remove any documents in Dashboard.
Anything else we need to know?:
It is good to check the reason for the problem is
documentIfNotAttached
flag: #560Environment:
yorkie version
): v0.4.12The text was updated successfully, but these errors were encountered: