Reputation: 55
I have a problem when adding data to my User
class by Mongoose that can't update it later by parse API.
I've found that's because of mongoose use ObjectId
for _id
field and parse just work with plain string as ObjectId
.
The question is how can I set my custom unique plain string as ObjectId in Parse Server
object creation?
Upvotes: 2
Views: 1002
Reputation: 650
You can do it like this:
const cryptoUtils = require('parse-server/lib/cryptoUtils');
const id = cryptoUtils.newObjectId();
Source: https://github.com/parse-community/parse-server/blob/master/src/cryptoUtils.js
Upvotes: 2