{"size": 492, "ext": "js", "max_stars_repo_path": "server/repository/ShopCart.js", "max_stars_repo_name": "cavassani/arco_iris_back_end", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "server/repository/ShopCart.js", "max_issues_repo_name": "cavassani/arco_iris_back_end", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "server/repository/ShopCart.js", "max_forks_repo_name": "cavassani/arco_iris_back_end", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.4285714286, "max_line_length": 55, "alphanum_fraction": 0.5995934959}
import mongoose from "../config/mongoose.js"
import schema from '../schema/ShopCart.js'

const model = mongoose.model('ShopCart', schema)

 const ShopCart = {
     async carts() {
        const carts = await ShopCart.find().populate({
            path: "items.productId",
            select: "name price total"
        });
        return carts[0]
     },
     async payload() {
        const newItem = await ShopCart.create(payload);
        return newItem
    }

 }

 export default ShopCart