Created
May 12, 2009 06:54
-
-
Save TheNicholasNick/110354 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// MAP | |
function(doc) { | |
if(doc["couchrest-type"] == "Quote" && doc.user_id && doc.updated_at && doc.created_at | |
&& doc.drivers["0"]["last_name"] && doc.drivers["0"]["first_name"] | |
&& doc.vehicle["year"] && doc.vehicle["make"] && doc.vehicle["family"] | |
&& doc.result["dollars"]["total"] | |
&& doc.updated_at && doc.created_at) { | |
emit( | |
doc.user_id | |
,{ | |
id: doc["_id"] | |
,last_name: doc.drivers["0"]["last_name"] | |
,first_name: doc.drivers["0"]["first_name"] | |
,vehicle: doc.vehicle["year"] + " " + doc.vehicle["make"] + " " + doc.vehicle["family"] | |
,premium: doc.result["dollars"]["total"] | |
,updated_at: doc.updated_at | |
,created_at: doc.created_at | |
} | |
); | |
} | |
} |
This file contains hidden or 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
{"total_rows":10,"offset":0,"rows":[ | |
{"id":"20c8099e62f6ea6b40c43fc1488c1de7","key":2,"value":{"id":"20c8099e62f6ea6b40c43fc1488c1de7","last_name":"Smith","first_name":"Zane","vehicle":"2009 Alfa Romeo 159","premium":1981.65,"updated_at":"2009/05/12 07:40:03 +0000","created_at":"2009/05/12 07:40:03 +0000"}}, | |
{"id":"458d91e48e5c9ca9c00f024e1a5329bb","key":2,"value":{"id":"458d91e48e5c9ca9c00f024e1a5329bb","last_name":"Edwin","first_name":"Lindsay","vehicle":"2009 Alfa Romeo 159","premium":1981.65,"updated_at":"2009/05/12 07:45:30 +0000","created_at":"2009/05/12 07:45:30 +0000"}}, | |
{"id":"574dd1be27434260f47e5d0845002909","key":2,"value":{"id":"574dd1be27434260f47e5d0845002909","last_name":"Smith","first_name":"Henry","vehicle":"2009 Alfa Romeo 159","premium":1981.65,"updated_at":"2009/05/12 07:45:30 +0000","created_at":"2009/05/12 07:45:30 +0000"}}, | |
{"id":"7409b56708234c5cafc6eceef776d5b7","key":2,"value":{"id":"7409b56708234c5cafc6eceef776d5b7","last_name":"Edwin","first_name":"Tane","vehicle":"2009 Alfa Romeo 159","premium":1981.65,"updated_at":"2009/05/12 07:40:05 +0000","created_at":"2009/05/12 07:40:05 +0000"}}, | |
{"id":"7858e9a413534f1079abbe3eb1f36dec","key":2,"value":{"id":"7858e9a413534f1079abbe3eb1f36dec","last_name":"Edwin","first_name":"John","vehicle":"2009 Alfa Romeo 159","premium":1981.65,"updated_at":"2009/05/12 07:45:29 +0000","created_at":"2009/05/12 07:45:29 +0000"}}, | |
{"id":"9944c5c96a3f0624a843e0f789f4d02c","key":2,"value":{"id":"9944c5c96a3f0624a843e0f789f4d02c","last_name":"Orr","first_name":"John","vehicle":"2009 Alfa Romeo 159","premium":1981.65,"updated_at":"2009/05/12 07:45:32 +0000","created_at":"2009/05/12 07:45:32 +0000"}}, | |
{"id":"ac9718171d7bb819a29f1785a3711ebe","key":2,"value":{"id":"ac9718171d7bb819a29f1785a3711ebe","last_name":"Chan","first_name":"Lindsay","vehicle":"2009 Alfa Romeo 159","premium":1981.65,"updated_at":"2009/05/12 07:40:04 +0000","created_at":"2009/05/12 07:40:04 +0000"}}, | |
{"id":"d2206678864a38f68c75b3cff0c4a6a0","key":2,"value":{"id":"d2206678864a38f68c75b3cff0c4a6a0","last_name":"Chan","first_name":"Tane","vehicle":"2009 Alfa Romeo 159","premium":1981.65,"updated_at":"2009/05/12 07:45:31 +0000","created_at":"2009/05/12 07:45:31 +0000"}}, | |
{"id":"e173994becea3d969ea4c19f2afb5d5c","key":2,"value":{"id":"e173994becea3d969ea4c19f2afb5d5c","last_name":"Edwin","first_name":"John","vehicle":"2009 Alfa Romeo 159","premium":1981.65,"updated_at":"2009/05/12 07:40:06 +0000","created_at":"2009/05/12 07:40:06 +0000"}}, | |
{"id":"f8349aba1aae1aa2a1c04e8c281a6123","key":2,"value":{"id":"f8349aba1aae1aa2a1c04e8c281a6123","last_name":"Smith","first_name":"Tane","vehicle":"2009 Alfa Romeo 159","premium":1981.65,"updated_at":"2009/05/12 07:39:32 +0000","created_at":"2009/05/12 07:39:32 +0000"}} | |
]} |
This file contains hidden or 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
{ | |
"success": true, | |
"rows": [ | |
{ | |
"created_at": "2009/05/12 07:40:03 +0000", | |
"updated_at": "2009/05/12 07:40:03 +0000", | |
"premium": 1981.65, | |
"vehicle": "2009 Alfa Romeo 159", | |
"id": "20c8099e62f6ea6b40c43fc1488c1de7", | |
"last_name": "Smith", | |
"first_name": "Zane" | |
}, | |
{ | |
"created_at": "2009/05/12 07:45:30 +0000", | |
"updated_at": "2009/05/12 07:45:30 +0000", | |
"premium": 1981.65, | |
"vehicle": "2009 Alfa Romeo 159", | |
"id": "458d91e48e5c9ca9c00f024e1a5329bb", | |
"last_name": "Edwin", | |
"first_name": "Lindsay" | |
}, | |
{ | |
"created_at": "2009/05/12 07:45:30 +0000", | |
"updated_at": "2009/05/12 07:45:30 +0000", | |
"premium": 1981.65, | |
"vehicle": "2009 Alfa Romeo 159", | |
"id": "574dd1be27434260f47e5d0845002909", | |
"last_name": "Smith", | |
"first_name": "Henry" | |
}, | |
{ | |
"created_at": "2009/05/12 07:40:05 +0000", | |
"updated_at": "2009/05/12 07:40:05 +0000", | |
"premium": 1981.65, | |
"vehicle": "2009 Alfa Romeo 159", | |
"id": "7409b56708234c5cafc6eceef776d5b7", | |
"last_name": "Edwin", | |
"first_name": "Tane" | |
}, | |
{ | |
"created_at": "2009/05/12 07:45:29 +0000", | |
"updated_at": "2009/05/12 07:45:29 +0000", | |
"premium": 1981.65, | |
"vehicle": "2009 Alfa Romeo 159", | |
"id": "7858e9a413534f1079abbe3eb1f36dec", | |
"last_name": "Edwin", | |
"first_name": "John" | |
}, | |
{ | |
"created_at": "2009/05/12 07:45:32 +0000", | |
"updated_at": "2009/05/12 07:45:32 +0000", | |
"premium": 1981.65, | |
"vehicle": "2009 Alfa Romeo 159", | |
"id": "9944c5c96a3f0624a843e0f789f4d02c", | |
"last_name": "Orr", | |
"first_name": "John" | |
}, | |
{ | |
"created_at": "2009/05/12 07:40:04 +0000", | |
"updated_at": "2009/05/12 07:40:04 +0000", | |
"premium": 1981.65, | |
"vehicle": "2009 Alfa Romeo 159", | |
"id": "ac9718171d7bb819a29f1785a3711ebe", | |
"last_name": "Chan", | |
"first_name": "Lindsay" | |
}, | |
{ | |
"created_at": "2009/05/12 07:45:31 +0000", | |
"updated_at": "2009/05/12 07:45:31 +0000", | |
"premium": 1981.65, | |
"vehicle": "2009 Alfa Romeo 159", | |
"id": "d2206678864a38f68c75b3cff0c4a6a0", | |
"last_name": "Chan", | |
"first_name": "Tane" | |
}, | |
{ | |
"created_at": "2009/05/12 07:40:06 +0000", | |
"updated_at": "2009/05/12 07:40:06 +0000", | |
"premium": 1981.65, | |
"vehicle": "2009 Alfa Romeo 159", | |
"id": "e173994becea3d969ea4c19f2afb5d5c", | |
"last_name": "Edwin", | |
"first_name": "John" | |
}, | |
{ | |
"created_at": "2009/05/12 07:39:32 +0000", | |
"updated_at": "2009/05/12 07:39:32 +0000", | |
"premium": 1981.65, | |
"vehicle": "2009 Alfa Romeo 159", | |
"id": "f8349aba1aae1aa2a1c04e8c281a6123", | |
"last_name": "Smith", | |
"first_name": "Tane" | |
} | |
], | |
"total": 10 | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment