Created
April 19, 2016 07:26
-
-
Save itsdevcoffee/5972b388cac5caa0b530b87f6f9ca88d 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
| import { Person } from '/lib/collections'; | |
| import { Groups } from '/lib/collections'; | |
| import { Realtor } from '/lib/collections'; | |
| import { Relocation } from '/lib/collections'; | |
| import { Meteor } from 'meteor/meteor'; | |
| import { check } from 'meteor/check'; | |
| export default function () { | |
| Meteor.methods({ | |
| 'person.map.model'() { | |
| const { userId } = this; | |
| let groups = Groups.find({userId}, {fields: {memeberEmail: 1}}).fetch(); | |
| let relocation = Relocation.find({userId}, {fields: {email: 1, phoneNumber: 1}}).fetch(); | |
| let realtor = Realtor.find({userId}, {fields: {clientName: 1, clentCell: 1, workPhone: 1}}).fetch(); | |
| let matchedArray = []; | |
| // Records where phoneNumber === cell or work | |
| relocation.forEach((reloc) => { | |
| let matchedRealtor = Realtor.find({clentCell: reloc.phoneNumber}).fetch() | |
| if(matchedRealtor.length > 0) { | |
| matchedArray.push(matchedRealtor); | |
| } | |
| }); | |
| console.log(matchedArray.length); | |
| } | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment