Iām slowly starting to figure it out, donāt know why your lookup in my eyes still doesnāt work how I expect it to but I realized why I was getting different field names.
When you return the array with the extra data in the as:'name" field in lookup it turns it into just a normal mongoDB kinda deal and it changes all the underlying field names so you get stuff like _id and _p_owner instead of just owner.
I couldnāt figure out how to fix the join Iām still getting all those extra rows I would expect the lookup to filter out so I just manually nulled all the invalid rows when rendering.
import { useState, useEffect } from "react";
import { Icon, Card, Button } from 'semantic-ui-react';
const Moralis = require('moralis');
import {useMoralis} from 'react-moralis';
const  CampPage = () => {
    const {user} = useMoralis();
    const [camps, setCamps] = useState(null);
    useEffect(() => {
        async function queryWrap() {
             if(user){
                const DonatedCampaign = Moralis.Object.extend('DonatedCampaign');
                const camps = new Moralis.Query(DonatedCampaign);
                camps.equalTo('donor', user);
                const temp = await Moralis.Cloud.run('getUserCampaignsData');
                
                setCamps(temp);
             }
            }
            queryWrap();
        }, [user]);
    
    if (camps){
        console.log(camps[0]['campInfo'][0]);
        console.log(camps[0]['campInfo'][0]['_p_owner']);
        //console.log(JSON.stringify(camps[0].get('campaign')));
        return (
            <div>
                <h1>Voted Campaigns</h1>
                <p> Your previously voted campaings:</p>
                <div>
                
                    {camps.map(campaign => (
                        
                        campaign['campInfo'].map(possibleCamp => (
                            possibleCamp['_id'] === campaign['campaign']['id'] ? (
                                <Card>
                                    <Card.Content>
                                        <Card.Header>{possibleCamp['name']}</Card.Header>
                                        <Card.Meta>
                                            <span className='date'>{campaign['next_vote'].toString()}</span>
                                        </Card.Meta>
                                    </Card.Content>
                                    <Card.Content extra>
                                        <a>
                                            <Icon name='user' />
                                            {possibleCamp['_p_owner']}
                                        </a>
                                    </Card.Content>
                                </Card>
                            ) : null
                        ))))
                    }
                </div>
            </div>
        )}else{
            return <div> broken </div>;
        }
}
// const getCampaigns = () => {
//     return Moralis.Cloud.run('getUserCampaigns');
// }
// export async function getStaticProps(){
//     const temp = await getCampaigns();
//     console.log(temp);
//     return {
//         props: {
//             campaigns: JSON.parse(JSON.stringify(temp))
//         }
//     }
// }
export default CampPage;
Can you suggest an aggregate function that is doing what ternary mapping is doing in my render?
Also I did add the , {useMasterKey:tree} (correct syntax thought because no error) and it made no difference.
Here is the moralis log for one of those queries