Giter Site home page Giter Site logo

Comments (1)

tgriesser avatar tgriesser commented on April 29, 2024

The library uses joins where appropriate (when doing a belongsToMany relation with an interim table) - otherwise, the query above is equivalent to:

SELECT * FROM sitesmeta
where sitesmeta.site_id =1

having the join statement doesn't really do anything there, since there's not a good way to split out all of the joined columns without requiring that the entire schema be defined in your model. Also, it uses WHERE IN when eager loading on multiple, so I'd say that this is the most efficient it's going to get without adding too much complexity. I'm also going to be doing a through method soon, that will allow for dynamic relations that uses joins and pass through another model... still finishing that up.

If you want to build a complex query, you should use the query method to add additional clauses to the current select / insert / delete statement executed on a model or collection.

from bookshelf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.