As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
Sorry if this is a duplicate post. I posted and can't find it anywhere.
How can I generate Mongo objectIDs myself.
In Node.js, I'd do the following :
var ObjectID = require('mongodb').ObjectID;
var myObjectID = new ObjectID();
Kinvey provides the collectionAccess.objectId() method. Unfortunately, this only CONVERTS existing strings to objectIDs. Can y'all rewrite this method so that it generates objectIds if no string is provided?
What's the use case? Are you looking to generate ObjectIDs for attributes other than _id?
J
Justin Noel
said
over 9 years ago
I will have a collection with documents that have subdocuments. Those subdocuments need a unique id that will be tied in a many-to-many relationship in another collection. I can create a GUID, but that is overkill size wise. The MongoDB ObjectID would work perfectly for this.
M
Michael
said
over 9 years ago
Actually the objectID method will also generate a random objectID:
Justin Noel
How can I generate Mongo objectIDs myself.
In Node.js, I'd do the following :
var ObjectID = require('mongodb').ObjectID;
var myObjectID = new ObjectID();
Kinvey provides the collectionAccess.objectId() method. Unfortunately, this only CONVERTS existing strings to objectIDs. Can y'all rewrite this method so that it generates objectIds if no string is provided?