Open franklloydteh opened 11 years ago
I know it's an issue 3 months old, but I stumbled upon it just a few days ago. I badly needed the same feature for a couple of PhoneGap projects, so I made it by myself, since it's not supported. I forked the project and commit the changes I made. Since I'm far from being a javascript guru, this code could have bugs and could break retrocompatibility (or maybe could be just bad written). Of course I tried not to, but I'm still testing it. It looks like ok, until now. I tried to implement support for filtering and ordering on joined table (both hasOne and hasMany), with a Hibernate-like dot notation (in the example you made, your filter call would have been:
Inventory.all().prefetch('ingredient')
.filter('ingredient.ingredientName','=',ingredientName)
.list(null,callback);
and the filter would have worked even without the prefetch) I also added a new function:
QueryCollection.prototype.queryOptions
Returns a new query collection with the provided options. Valid options are:
As I said, I am not an expert. The fork ( https://github.com/kendalen/persistencejs ) is public, if it can be of any help and if, after some tests, it proves stable as it looks like now, I could make a pull request to Zef (by the way, Zef: great work!). I am new to GitHub, too. :(
@kendalen Please, make a pull request on your fork, it looks awesome :)
Does not look like this patch was ever taken into the main project...can you confirm yes/no ?
As far as I know, no, it wasn't. I still have to make a pull request: I hope to find some times in the next few days to review the code and read how to make the request (my first time :) ). Thank you both.
I have the following defined.
I would like to fetch an inventory based on the ingredientName, is this not possible ?