Skip to content

Can't save to any object in Cloud code (updated title) #513

Closed
@mikepaggi

Description

@mikepaggi

I'm not sure if it's an issue or if i'm doing something wrong or not but I can't seem to get files to upload in Cloud code. Now I did create a GridFS bucket in my MongoDB with a name but also not sure how it knows to save to it? I kept my code for what gets returned from the saving of the file, but i also was chaining with .url() before that. (not sure why i can't get my code to preview correctly below but should help get the idea of what i'm trying to do.)

`return breweryLabelPromise = breweryLabelPromise.then(function(){

                return Parse.Cloud.httpRequest({
                    url: singleReturnedUntappdBeer.brewery.brewery_label
                }).then(function(labelDownload){

                    return labelDownload.buffer;

                }).then(function(breweryLabelData){

                    var breweryLabelFile = new Parse.File(singleReturnedUntappdBeer.brewery.brewery_label, { base64: breweryLabelData.toString("base64") } );
                    return breweryLabelFile.save().then(function(returnedBreweryLabelURL){
                        console.log("Here is the returned saved Brewery Label URL: " + returnedBreweryLabelURL);
                        breweryModelPush.set('brewery_label', returnedBreweryLabelURL); 
                    });

                });

            });`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions