Created
February 28, 2012 03:54
-
-
Save EchoAbstract/1929282 to your computer and use it in GitHub Desktop.
Many-to-Many REST
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Find all Dr's named Joe at Mercy Hospital | |
GET /appdata/[appKey]/doctors/?query={"firstName": "Joe", "hospital": "Mercy"} | |
[{"_id": "998798ad987fe987e987bc98766", | |
"firstName": "Joe", | |
"lastName": "Brown", | |
"hospital": "Mercy", | |
"speciality": "oncology"}, | |
{"_id": "ca6775feba86554", | |
"firstName": "Joe", | |
"lastName": "Baker", | |
"hospital": "Mercy", | |
"speciality": "internal medicine"}] | |
// Find all patients seen by Dr. Joe Brown | |
GET /appdata/[appKey]/patients/?query={"doctors":"998798ad987fe987e987bc98766"} | |
[{"_id": "001", | |
"firstName": "Waldo", | |
"lastName": "Bond", | |
"doctors": ["998798ad987fe987e987bc98766", "98698ad989d987f9987e"], | |
"history": "..."}, | |
{"_id": "002", | |
"firstName": "Keith", | |
"lastName": "Emerson", | |
"doctors": ["998798ad987fe987e987bc98766", "82888277266ffaacafe", "ca6775feba86554"], | |
"history": "..."}] | |
// Find Waldo's other Doctor | |
GET /appdata/[appKey]/doctors/98698ad989d987f9987e | |
{"_id": "98698ad989d987f9987e", | |
"firstName": "Mary", | |
"lastName": "Ng", | |
"hospital": "Tufts Medical Center", | |
"speciality": "internal medicine"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment