Development Team/Almanac/sugar.datastore.datastore: Difference between revisions
Dfarning-bot (talk | contribs) m Robot: Automated text replacement (-{{Sugar Almanac TOC}} +{{Almanac TOC}}) |
|||
| Line 31: | Line 31: | ||
</pre> | </pre> | ||
=== How do I provide a query to the datastore.find() method so that I can find datastore objects with a particular property? === | === How do I provide a query to the datastore.find() method so that I can find datastore objects === | ||
IMPORTANT: Do not rely on datastore.find() method in all cases, its behaviour could be changed in future releases;<br>there is only on thing for sure: to treat jobjects that were created within activity use:<br>datastore.find({'activity_id': <activity_id>, ...}) | |||
with a particular property? === | |||
The datastore package includes a find() helper function that allows you to find things in the datastore. Belows is a very simple example use of find where I simply search for journal entries that have a title of 'file1.txt'. I think print out the title and file path for each retreived entry. | The datastore package includes a find() helper function that allows you to find things in the datastore. Belows is a very simple example use of find where I simply search for journal entries that have a title of 'file1.txt'. I think print out the title and file path for each retreived entry. | ||