Skip to content

Let clients define objectId using mongo/mongoose ObjectId() #6101

Closed
@rhuanbarreto

Description

@rhuanbarreto

This issue follow up on #4170 but goes deeper in it.

It's not really safe to leave the user to set an objectId arbitrarily, but for offline PWAs it's almost mandatory that an ID must be generated offline. Normally UUIDs are used, but as Parse uses MongoDB, we can generate objectId's using the native mongo library for Node.js or Mongoose ObjectId Type for Client Javascript Applications.

So on Parse Server, this client-side created id could be allowed using a specific __type when you set this on a POST request, extending the normal JSON types. Also, on PostgreSQL you can allow the UUID __type, once it's more normal to use.

Also, the risk of overwriting objects using this method falls over the client/developer and not the server. So anyone that is using this "advanced" method will assume the risks of ID collision. Even UUIDs have this risk despite being negligible on small projects.

I think this is an important feature to be considered and it will make a big leap forward for using Parse Server on offline PWAs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:featureNew feature or improvement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions