Start a new topic

Backbone library query, possible to use a projection? (select only specific fields)

Hi,



i would like to do a query where i select a specific set of attributes of a model instead of fetching the whole object.

I did not found anything about this in the documentation



How can this be done?



Thanks in advance.

This is currently not supported by the Backbone library. As an alternative, you could add a post-fetch hook stripping out the fields you don’t want to retrieve. What is your main concern with selecting all fields?
Thanks. Basically i have an object with some basic fields and a field which has a lot of text (css), and when i fetch several of these it takes quite long before i retrieve them, while i actually just want to list the basic fields of the object.



Another solution i could do is store the big field in a new collection and put a reference to it in the object. This might be the best solution i guess.. :)
If you are indeed seeing delays in retrieving data, storing them separately is indeed the best way to go.
Just wanted to ask if this can be tagged as a feature request? I think it can give many benefits when it's supported.
Yes, it’s already on our roadmap as more people asked for it.
Great!
Just wanted to ask when this feature will/planned to be available as i don't find any roadmap on the site and it would save me a lot of work :)
Jonas, I prioritized this feature, and it will be available mid next week. I’ll keep this thread updated.
Jonas, the 1.1.7 version of the library contains the [Field Selection feature](http://devcenter.kinvey.com/guides/datastore#FieldSelection).
Thanks for the update!
Login or Signup to post a comment