Tech Tips

  1. Uncategorized
  2. 49 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) {
		} 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. Udacity Self-Driving Car Engineer Nanodegree …

  2. Install sbt 1.0.0 and run sample template

  3. Visualization of Neural Network and its Train…

  4. [Machine Learning]Created docker image includ…

  5. [Node.js]How to write batch script with Node.…