Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API for data type UUID #3244

Closed
RealmBot opened this issue Sep 21, 2020 · 1 comment
Closed

API for data type UUID #3244

RealmBot opened this issue Sep 21, 2020 · 1 comment
Assignees

Comments

@RealmBot
Copy link
Collaborator

RealmBot commented Sep 21, 2020

Schema

A schema with a UUID property:

const Person = {
  name: “Person”,
  properties: {
    id: “uuid”,
    name: “string”
  }
};

Creating objects with UUID

The BSON library does not have a class for UUID. Currently users of the MongoDB node.js driver are using the uuid-mongodb package. Using the 3rd party package, creating an object will look like:

const MUUID = require('uuid-mongodb');
realm.write(() => {
  realm.create(“Person”, { id: MUUID.v4(), name: “John Doe” });
});

When a proper UUID class is added to the BSON library, we imagine that we should use the following instead:

const UUID = require('bson').UUID;
realm.write(() => {
  realm.create(“Person”, { id: new UUID(), name: “John Doe” });
});

The above API for creating a new object will be consistent with the API for both ObjectId and Decimal128 (also from the BSON library).

@sync-by-unito sync-by-unito bot assigned steffenagger and unassigned kneth Nov 2, 2020
@sync-by-unito sync-by-unito bot assigned kneth and unassigned steffenagger Nov 30, 2020
@kneth kneth mentioned this issue Dec 18, 2020
23 tasks
@sync-by-unito sync-by-unito bot assigned steffenagger and unassigned kneth Jan 4, 2021
@sync-by-unito
Copy link

sync-by-unito bot commented Jan 18, 2021

➤ Steffen Agger commented:

Local mock implemented, awaiting UUID in bson-package.

@sync-by-unito sync-by-unito bot closed this as completed Jan 18, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants