Querying: Query vs DocumentQuery

Unlike .NET, Node.js client offers single API for querying documents.

Below you can find examples of equivalent calls.

query() method in DocumentSession is shorthand for calling session.advanced.documentQuery().

session.query(Order);

is equivalent to:

session.advanced.documentQuery(Order);

session.query({ indexName: "Orders/ByShipToAndLines" });

is equivalent to:

session.advanced.documentQuery({ indexName: "Orders/ByShipToAndLines" });

session.query({ indexName: "Orders/ByShipToAndLines" });

is equivalent to:

session.advanced.documentQuery({ 
    indexName: "Orders/ByShipToAndLines", 
    isMapReduce: false,
    collection: null
});

session.query({ collection: "orders" });

is equivalent to:

session.advanced.documentQuery({ 
    collection: "orders",
    indexName: null,
    isMapReduce: false
});