Last active
August 29, 2015 14:02
-
-
Save grplyler/c3f64db0c8ea817a8053 to your computer and use it in GitHub Desktop.
How do you delete a document of a document in blitzdb?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete a task from a project in the database with blitzdb | |
# (Snippet, Other classes defined above) | |
def remove_task(self, title_or_id): | |
# This is what i want to do: | |
project = self.backend.filter(Project, {'title': 'some_project'}) | |
task = project.filter(Task, {'title': 'some_task'}) | |
self.backend.delete(task) | |
# Or this (should return a task) | |
task = self.backend.filter(Project, {'name': 'some_project', | |
'tasks': [ | |
{'name': 'task1'}, | |
] | |
} | |
) | |
# Here's the document i have | |
project = { | |
'title': 'some_project', | |
'desc': '', | |
'tasks': [ | |
{'name': 'task1', | |
'desc': '', | |
'done': False, | |
}, | |
{'name': 'task2', | |
'desc': '', | |
'done': False, | |
} | |
] | |
} | |
# Here is the result i have like to retrieve and delete or just delete: | |
task = { | |
'name': 'task2', | |
'desc': '', | |
'done': False, | |
} | |
# Am i just doing this all wrong? Could you point me in the right direction. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment