- Where Developers Learn, Share, & Build Careers


This question is 'same', but I'm asking for alternative (if it exists).

I have made a DB number with a collection number in the Mongo Shell. Use of Mongo as ODM I want to reach the collection and list of numbers

  var mongoose = expected ('mongos'), schema = Mongoose. Sema; Mongoose.connect ('MongoDB: // local host / Nums'); Mongoose.model ('number', new schema ({value: number})); Mongoose.connection.on ('open', function (ref) {console.log ('Mongo server to connect.');}); Mongoose.connection.on ('error', function (mistake) {console.log ('Could not connect to Mongo Server!'); Console.log (err);}); Var nums = mongoose.model ('number'); Nums.find ({}, function (mistake, data) {console.log (error, data, data. Length);});   

To access a previously created database / archive, I have to always go through mongoose.model and new schema call ? Can this step bypass?

Although this step is to be written once, it seems that if I have a large schema then it will be very difficult to remove DB / collection from Mongo.

Is there a job for this or is this the only way?

If you want to use the Mongoose API to use the archive, Need to define. If you do not want to define a schema for archiving, you need to use it or access it.

Comments

Popular posts from this blog

java - NullPointerException for a 2d Array -

python - Assemble mpeg file unable to play in mediaplayer -

c# - NameSpace Manager or XsltContent to parse aspx page -