question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Define own entityId

See original GitHub issue

Awesome package this is! ❤

Is there a way to define an own entityId?

I see there is a methode generateId() that is automatically called on Schema construction.

I would like to pass an existing generated id from an auth service or something similar.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
CaptainCodemancommented, Apr 15, 2022

Just came across this, I want to assign my own ID so used the entity constructor like this:

const post = new Post(PostSchema, 'my-post', postData)
const id = await repository.save(post)
// id === 'my-post'
2reactions
guyroysecommented, Jan 28, 2022

Actually, there is a configuration option when you create your schema to override the ID generation. It’s documented here: https://github.com/redis/redis-om-node/blob/main/docs/README.md#schemaoptions.

The tl;dr:

let schema = new Schema(SomeEntity, {
  foo: { type: 'string' },
  bar: { type: 'number' }
}, {
  idStrategy: myIDGeneratorFunc
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Create a Unique Entity ID for SSO/SAML in IriusRisk
Defining the custom entity ID​​ You can configure a custom entity ID in your SAMLv2-config.groovy file. The first part that you will be...
Read more >
Understanding Entity ID when URI is URL should I use HTTP ...
An entityID is just the "handle" for your Identity Provider (IdP). It should be constant across all the Service Providers you interact with....
Read more >
Unique Entity ID is Here - GSA.gov
The Unique Entity ID is generated in SAM.gov. If you are registered in SAM.gov (active or not), you already have a Unique Entity...
Read more >
Trading Entity ID Definition | Law Insider
Trading Entity ID means a unique ID provided by Clearing Corporation to each Trading Entity, for the purpose of identifying the entity accessing...
Read more >
Adding custom attributes based on entityID
In order to abstract the burden of treating different attribute values as the user ID in our application, we decided to define every...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found