You are currently browsing legacy 3.0 version of documentation. Click here to switch to the newest 5.1 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Session: Querying: How to use intersect?

To return only documents that match all provided sub-queries we have introduced intersect extension that enables us to do server-side intersection queries.


public IRavenQueryable<T> intersect();
Return Value
IRavenQueryable Instance implementing IRavenQueryable interface containing additional query methods.


// return all T-shirts that are manufactured by 'Raven'
// and contain both 'Small Blue' and 'Large Gray' types
QIntersection_TShirt t = QIntersection_TShirt.tShirt;
QIntersection_TShirtType tt = QIntersection_TShirtType.tShirtType;
List<TShirt> tshirts = session
  .query(TShirt.class, TShirts_ByManufacturerColorSizeAndReleaseYear.class)