Skip to content

Instantly share code, notes, and snippets.

@slaith
Created January 29, 2017 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save slaith/d6093b66ca0fd9000f8bc34d087c8e86 to your computer and use it in GitHub Desktop.
Save slaith/d6093b66ca0fd9000f8bc34d087c8e86 to your computer and use it in GitHub Desktop.
gist
var MongoClient = require('mongodb').MongoClient
, assert = rsuequire('assert');
// Connection URL
var url = 'mongodb://localhost:27017/myproject';
// Use connect method to connect to the server
MongoClient.connect(url, function(err, db) {
assert.equal(null, err);
console.log("Connected successfully to server");
var comments=db.collection("comments");
db.close();
});
module.exports= MongoClient
@slaith
Copy link
Author

slaith commented Jan 29, 2017

var mongoose = require("mongoose");

var CommentSchema = new mongoose.Schema({
text: {
type: String

},
equipped: Boolean,
user: {type:String},

});

var Comment = mongoose.model('Comment', CommentSchema);

module.exports = {
Comment: Comment
}

@slaith
Copy link
Author

slaith commented Jan 29, 2017

extends layout

block content
.container
form.form-horizontal(role='form' action="/comments" method="post")
h2 Add Event
.form-group
label.col-sm-3.control-label(for='firstName') Name
.col-sm-9
input#firstName.form-control(type='text', placeholder='Full Name', name="name" autofocus='')
span.help-block Name of the event

		.form-group
			label.col-sm-3.control-label(for='birthDate') Start Date
			.col-sm-9
				input#birthDate.form-control(type='date', name="startdate")
		.form-group
			label.col-sm-3.control-label(for='City') City
			.col-sm-9
				select#country.form-control(name="City")
					option New Delhi
					option Gurgaon
					option Noida
					option Bengaluru
					option Mumbai
					option Kolkata
					option Chennai
		// /.form-group

		.form-group
			.col-sm-9.col-sm-offset-3
				button.btn.btn-primary.btn-block(type='submit') Create
	// /form
// ./container

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