Adding data to the field having ID in mongoose

July 31   node.js 0 3 Views
Advertisement

I have a collection employees in that I want to put id field along with default _id field. But I can't able to create the record. I tried below way

employee = new Employee({id: "1234", name: "emp name"}) employee.save 

First time it is creating record only with name. Can anyone help me out of this. I put unique index for id field.

Advertisement

Replay

Tags: mongoose, node.js
PC site About | Contact

©2016 avrocks.com all rights reserved

processed in 0.192 (s). 5 q(s)