Tech Tips

  1. Uncategorized
  2. 266 view

[mongoose][mongoDB]How to select collection

Select collection at “lower case of collection_name+s” part below. Note that you have to add “s” at last end use lower case of collection name.
var EventRelation, db, mongoose;
mongoose = require('mongoose');
db = mongoose.connect('mongodb://localhost/db_name',
	function(err) {
		if (err) {
			console.log(err);
		} else {
			console.log('Connection Success!');
		}
	}
);

DBSchema = new mongoose.Schema({
  id                   : Number,
  update_time          : Date
});

exports.testDB = db.model('lower case of collection_name+s', DBSchema);

Uncategorized recent post

  1. Run Amazon FreeRTOS on M5Stack Core2 for AWS …

  2. Udacity Self-Driving Car Engineer Nanodegree …

  3. Install sbt 1.0.0 and run sample template

  4. Visualization of Neural Network and its Train…

  5. [Machine Learning]Created docker image includ…

関連記事

PAGE TOP