-
Notifications
You must be signed in to change notification settings - Fork 3
3.1 Partial Answers
Lucas Rocha edited this page Feb 7, 2019
·
9 revisions
To use partial answers, simply provide the attribute/property names separated by commas. For example fields=name,age
signals that only the name and age should be listed in the query result. For access to the second level use the syntax fields=property.property1
.
Example: Retrieve the list of users containing only name, age and date of registration.
http://localhost:3000/?fields=name,age,created_at
Result:
fields: {
name: 1,
age: 1,
created_at: 1
}
Example: Retrieve the list of users containing name and city of the address property. In this case, we are considering the address object as a second level.
http://localhost:3000/?fields=name,address.city
Result:
fields: {
name: 1,
address.city: 1
}