How can I cast an ObjectId to a number? In my app I'm using the latest mongoose version and backbone on the clientside.
My problem is that the ObjectId always ends up being put in between quotes which results in double quotes like ""233453452534"" in my jade templates and on my client.
edit:
I'm querying mongodb with
this.users.find({},function(err,docs){
cb(null,docs)
})
console.log(docs) shows
{ name: 'test',
_id: 5220bc207f0c866f18000001,
__v: 0 }
in my template
option(data-id=val._id) #{val.name}
i pass this to res.render
res.render('test.jade',docs)
and my html renders:
""5220bb43b754af4118000001""
with double quotes arround my object id. i tried to set a number in a schema and this works, no quotes arround it if it's a number, so my guess is that that happens because it's an objectID.