Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

GridFS + Mongoose #5

Open
Open

Description

@CodersBrothers

Its possible use with "Mongoose", instead of "mongo" module?
Thanks.

Activity

  1. aheckmann commented on May 7, 2013

    @aheckmann
    Owner

    Yes. Mongoose uses the mongodb module. Instructions for accessing it are
    here: https://github.com/aheckmann/gridfs-stream#using-with-mongoose

    On Tuesday, May 7, 2013, Coders Brothers wrote:

    Its possible use with "Mongoose", instead of "mongo" module?
    Thanks.

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/5
    .

    Aaron
    @aaronheckmann https://twitter.com/#!/aaronheckmann

  2. CodersBrothers commented on May 8, 2013

    @CodersBrothers
    Author

    Im really new with mongoose and mongo in NodeJS, i cant connect, because seems i need put a model and i cant get collection reference :(

  3. CodersBrothers commented on May 8, 2013

    @CodersBrothers
    Author

    My code, but dont work, upload dont return nothing.

    var express = require('express'),
         http = require('http'),
         path = require('path'),
    
         formidable = require('formidable'),
         gridform = require('gridform'),
         mongoose = require('mongoose'),
         Grid = require('gridfs-stream');
    
        var conn = mongoose.createConnection('mongodb://' + database.server + ':' + database.port + '/'  + database.name);
       conn.once('open', function(err){
        if(!err){
            console.log('Conectado a Mongo!!');
        }else{
            throw err;
        }
    });
    
    
    // Upload
    app.post('/upload', function(req, res){
    
        gridform.db    = conn.db,
        gridform.mongo = mongoose.mongo;    
    
        var form = gridform();  
    
        //console.log(form);
    
        form.parse(req, function(err, fields, files) {
    
            console.log("File ID:" + files.text.id);
            res.end("File ID:" + files.text.id);
    
        });
    
    });
    
  4. CodersBrothers commented on May 8, 2013

    @CodersBrothers
    Author

    Imposible, i cant run Express + mongoose + gridform. :(, this is my script http://paste2.org/C2sKGNG3 (I cant save, i cant get)

  5. MForMarlon commented on Mar 13, 2015

    @MForMarlon

    @CodersBrothers Did you try putting the gridform.db and gridform.mongo lines inside the conn.once callback?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions