{
  "_id": "_design/adopt-a-street",
  "views": {
    "users_by_email": {
      "map": "function(doc) { if (doc.type === 'user') { emit(doc.email, doc); } }"
    },
    "streets_by_location": {
      "map": "function(doc) { if (doc.type === 'street') { emit(doc.location, doc); } }"
    },
    "by_user": {
      "map": "function(doc) { if (doc.user && doc.user.userId) { emit(doc.user.userId, doc); } }"
    },
    "users_by_points": {
      "map": "function(doc) { if (doc.type === 'user') { emit(doc.points, doc); } }"
    },
    "posts_by_date": {
      "map": "function(doc) { if (doc.type === 'post') { emit(doc.createdAt, doc); } }"
    },
    "streets_by_status": {
      "map": "function(doc) { if (doc.type === 'street') { emit(doc.status, doc); } }"
    },
    "events_by_date_status": {
      "map": "function(doc) { if (doc.type === 'event') { emit([doc.date, doc.status], doc); } }"
    },
    "comments_by_post": {
      "map": "function(doc) { if (doc.type === 'comment' && doc.post && doc.post.postId) { emit(doc.post.postId, doc); } }"
    },
    "transactions_by_user_date": {
      "map": "function(doc) { if (doc.type === 'point_transaction' && doc.user && doc.user.userId) { emit([doc.user.userId, doc.createdAt], doc); } }"
    }
  },
  "indexes": {
    "users_by_email": {
      "index": {
        "fields": ["type", "email"]
      },
      "name": "user-by-email",
      "type": "json"
    },
    "streets_by_location": {
      "index": {
        "fields": ["type", "location"]
      },
      "name": "streets-by-location",
      "type": "json"
    },
    "by_user": {
      "index": {
        "fields": ["type", "user.userId"]
      },
      "name": "by-user",
      "type": "json"
    },
    "users_by_points": {
      "index": {
        "fields": ["type", "points"]
      },
      "name": "users-by-points",
      "type": "json"
    },
    "posts_by_date": {
      "index": {
        "fields": ["type", "createdAt"]
      },
      "name": "posts-by-date",
      "type": "json"
    },
    "streets_by_status": {
      "index": {
        "fields": ["type", "status"]
      },
      "name": "streets-by-status",
      "type": "json"
    },
    "events_by_date_status": {
      "index": {
        "fields": ["type", "date", "status"]
      },
      "name": "events-by-date-status",
      "type": "json"
    },
    "comments_by_post": {
      "index": {
        "fields": ["type", "post.postId"]
      },
      "name": "comments-by-post",
      "type": "json"
    },
    "transactions_by_user_date": {
      "index": {
        "fields": ["type", "user.userId", "createdAt"]
      },
      "name": "transactions-by-user-date",
      "type": "json"
    }
  },
  "language": "javascript"
}