Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create projection builder API #12

Open
alechenninger opened this issue May 9, 2015 · 0 comments
Open

Create projection builder API #12

alechenninger opened this issue May 9, 2015 · 0 comments

Comments

@alechenninger
Copy link
Owner

// single, simple projection
var allFields = include("*").recursively();

// include all except some
// multiple projections use array
var exceptSome = [
  include("*").recursively(),
  exclude("some")
];

// array projection
var jsonExampleFromDocs =  [ { "field": "address", "include": true,
     "match": { "city": "Raleigh" }, "project": { "streetaddress": true} } ]

var streetAddressesInRaleigh = include("address")
    .where(field(city).equalTo("Raleigh"))
    .project(include("streetaddress"));

// alternates:
include("streetaddress").in("address").where(field("city").equalTo("Raleigh"));
in("address").where(field("city").equalTo("Raleigh")).include("streetaddress");

Main question is what does it mean in array projection to "include": false?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant