0
votes

I know I have to define Schema's in Mongoose, but I have a case where I'm connecting to a MongoDB via

dsn = "mongodb://#{config.database.username}:#{config.database.password}@#{config.database.host}/{config.database.name}"
mongoose.connect(dsn, (err) -> throw err if err)

And most of my writes will be using Models the way I'm supposed to. But there is this one read that I have to do from a Collection and it's Schema-less. Meaning, it's unprocessed data that was stored by another process. How can I successfully read from that then write to other collections using my Schemas?

If I use mongoose, can I not do this?

1

1 Answers

1
votes

To start with you can just make a blank schema for it.

var OtherSchema = new Schema({}, {collection: 'your-collection-name'});

Mongoose.model('Other', OtherSchema);

// ..