You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to node-mong...@googlegroups.com
Hi all. I'm using the mongojs wrapper around mongodb node driver, and when i try to create a client-side id with new ObjectId() i get an error saying the argument must be a single string of 12 bytes or a string of 24 hex characters, so it seems that the ObjectId constructor is requiring an _id argument, but the api docs specify that without arguments ObjectId will create a new _id instance. What may be the issue here?
Thanks.
cris
unread,
Sep 24, 2012, 7:24:53 PM9/24/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to node-mong...@googlegroups.com
Here's the code:
var db = require('mongojs'); var dbd = db.connect('testdb');
var id = new db.ObjectId();
dbd.collection('docs').count( function (err, doc) { dbd.collection('docs').insert({"_id": id, "title": "My title", "content": "My content", function (err, doc) { if (err) {console.log(err);} }); console.log('obj literal load to MongoDB'); });
christkv
unread,
Sep 25, 2012, 7:23:07 AM9/25/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to node-mong...@googlegroups.com
better log this as an issue in the github tracker as it's not a driver issue
cris
unread,
Sep 25, 2012, 3:28:25 PM9/25/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to node-mong...@googlegroups.com
Yes, it´s a mongojs issue; suits me for not reading their docs carefully where they state that mongojs try to emulate mongodb native driver "as much as possible". Here's the code where they implement ObjectId instantiation: