Q:

Splitting up collection in order to convert to excel/csv

My collection is almost 2GB and i need to put it into mySQL. Its too big for any converters. So i was thinking of splitting collection. Make table with HotelInfo where HotelID is the key, and have a second table that has HotelID and ReviewID with the rest of the review questions. I am really new to using mongoDB and JSON files so i am beyond confused. 
The format of JSON file :
{
"_id": string
"Reviews": [{
    "Ratings": {
    "Service"(optional): numeric,
    "Cleanliness"(optional): numeric,
    "Overall": numeric,
    "Value"(optional): numeric,
    "Sleep Quality"(optional): numeric,
    "Rooms"(optional): numeric,
    "Location"(optional): numeric
    },
    "AuthorLocation": string,
    "Title": string,
    "Author": string,
    "ReviewID": string,
    "Content": string,
    "Date": ISODate()
}],
"HotelInfo": {
    "Name": string,
    "HotelURL": string,
    "Price": string,
    "Address": string,
    "HotelID": string,
    "ImgURL": string
    }
}

How can i "split" the collection and save it to a seperate JSON file and so then I can convert it to csv/excel?

A:

You could use $out to write the results of your aggregation into a new collection. Here is an example:
For your hotelInfo
db.yourCurrentCollection.aggregate([{
        $project: { 
            // here you are just copying your fields to the new collection structure
            name: "$HotelInfo.Name",
            hotelUrl: "$HotelInfo.HotelURL",
            price: "$HotelInfo.Price",
            address: "$HotelInfo.Address",
            hotelId: "$HotelInfo.HotelID",
            imgUrl: "$HotelInfo.ImgURL"
        }
    },
    {
        $out: "hotelInfo" // The name of your new collection
    }
])

For your Reviews it would be a little bit trickier but you would have to flatten your array with $unwind, copy your fields to the new structure (similarly to your hotelInfo) and write it to your new collection. Example:
db.yourCurrentCollection.aggregate([
{ $unwind: "$Reviews"},
{ $project:{
    service: "$Reviews.Ratings.Service",
    cleanliness:  "$Reviews.Ratings.Cleanliness",
    overall: "$Reviews.Ratings.Overall",
    value: "$Reviews.Ratings.Value",
    sleep_quality: "$Reviews.Ratings.Sleep Quality",
    rooms: "$Reviews.Ratings.Rooms",
    location: "$Reviews.Ratings.Location",
    authorLocation: "$Reviews.AuthorLocation",
    title: "$Reviews.Title",
    author: "$Reviews.Author",
    reviewId: "$Reviews.ReviewID",
    content: "$Reviews.Content",
    date: "$Reviews.Date",
}},
{ $out : "reviewInfo" }  
])

But have you thought of foreign keys? Would you need to connect the hotelInfo to a specific review? If so you would have to add a foreign key in your reviewInfo collection with a hotelId.

Regarding the connection between the documents, as you mentioned in the comment you can add the hotelId is your reviewInfo collection. Here an example:
db.yourCurrentCollection.aggregate([
{ $unwind: "$Reviews"},
{ $project:{
    service: "$Reviews.Ratings.Service",
    cleanliness:  "$Reviews.Ratings.Cleanliness",
    overall: "$Reviews.Ratings.Overall",
    value: "$Reviews.Ratings.Value",
    sleep_quality: "$Reviews.Ratings.Sleep Quality",
    rooms: "$Reviews.Ratings.Rooms",
    location: "$Reviews.Ratings.Location",
    authorLocation: "$Reviews.AuthorLocation",
    title: "$Reviews.Title",
    author: "$Reviews.Author",
    reviewId: "$Reviews.ReviewID",
    content: "$Reviews.Content",
    date: "$Reviews.Date",
    hotelId: "$HotelInfo.HotelID" // Here you add the connection of each document
                                 // to a hotelId
}}

{ $out : "reviewInfo" }  
])

