I am trying to use mongoose js program to do the inserts, however I want to use 1,2,3,4 etc as the ids NOT to use the BSON ObjectID automatically created for me.
var mongoose = require('mongoose');
var dbHost = 'mongodb://localhost:27017/mong_db';
//var newID = mongoose.model('bookSchema', { _id: Number, name: String });
mongoose.connect(dbHost);
//Create a schema for Book
var bookSchema = mongoose.Schema({
_ id: Number,
name: String,
//Also creating index on field isbn
isbn: {type: String, index: true},
author: String,
pages: Number
});
>Updated
var book1 = new Book({
_id = 1
name:"Mongoose Demo 1",
isbn: "MNG123",
author: "Author1, Author2",
pages: 123
});