Open KeironO opened 7 years ago
I've written a small get_queryset
function in the resource I want to query.
def get_queryset(self, *args, **kwargs):
return super(MetaboliteAdductsResource, self).get_queryset(*args, **kwargs).fields(name=1, accurate_mass=1, molecular_formula=1)
However, I'm struggling a little bit to work out how to add the projection operator into this.
Slowly getting there, but I still have a small problem surrounding the fact that the projection still doesn't work as intended.
def get_queryset(self, *args, **kwargs):
return super(MetaboliteAdductsResource, self).get_queryset(*args, **kwargs).fields(name=1, accurate_mass=1,
molecular_formula=1, adducts=1,
adducts_negative_peaks__S = 1
Returns all embedded documents in adducts, despite the obvious projection.
And I've just realised that the projection is incorrect, any help would be greatly appreciated :+1:
Thanks,
Keiron.
Hey there,
I have written the following MongoDB schema to return required data, notice the use of a projection on adducts.positive.peaks.
However, there doesn't seem to be any clear way of doing this in flask-mongorest.
Are there any plans to implement the
$
operator in flask-mongorest?Thank you,
Keiron.