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

Can I add extra labels to nodes when CREATE or MERGE with query builder? #164

Open
liuyiqi1999 opened this issue Apr 10, 2022 · 0 comments

Comments

@liuyiqi1999
Copy link

I have the model Event:

instance = require('neode')
            .fromEnv()
            .with({
                Event: event,
                User: user
            });

const event = {
    type: 'string',
    category: 'string',
    trackerId: 'string',
    eventId: 'number',
    data: 'string',
    time: 'number',
    level: 'string',
    uid: 'number'
}

I can add nodes by some model with query builder like this now:

const res = await builder
    .merge('e', "Event", {
        type: event.type,
        category: event.category,
        trackerId: event.trackerId,
        eventId: event.eventId,
        data: JSON.stringify(event.data),
        time: event.time,
        level: event.level,
        uid: uid,
    })
    .return("e")
    .execute();
const eId = instance.hydrateFirst(res, "e").id();

I would like to add extra labels when adding new nodes, which means something like MERGE (e:Event:Debug:User), so I can get more dimensions for these nodes.

How can I add extra labels besides the model name itself when running instead of defining static ones when defining models at the very beginning?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant