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

d.init_db with schema from Javascript #73

Closed
motosota opened this issue Apr 29, 2015 · 2 comments
Closed

d.init_db with schema from Javascript #73

motosota opened this issue Apr 29, 2015 · 2 comments

Comments

@motosota
Copy link

Hi,

I'm struggling to use d.init_db and create a schema at the same time like so:

d.init_db([[1, "name", "Ivan"],[1, "age", 17],[2, "name", "Igor"],[2, "age", 35][1, "friend", 2]], [{"friend": {":db/valueType": ":db.type/ref"}}]);

Gives
Error: nth not supported on this type function Object() { [native code] }

What am I doing wrong?

Mike

@tonsky tonsky closed this as completed in e16341c Apr 30, 2015
@tonsky
Copy link
Owner

tonsky commented Apr 30, 2015

It’s a bug in DS and also you shouldn’t wrap schema in Array. Correct code should be:

d.init_db([[1, "name", "Ivan"],
            [1, "age", 17],
            [2, "name", "Igor"],
            [2, "age", 35],
            [1, "friend", 2]],
  {"friend": {":db/valueType": ":db.type/ref"}});

@tonsky
Copy link
Owner

tonsky commented Apr 30, 2015

@motosota just pushed new release for you https://github.com/tonsky/datascript/releases/tag/0.11.0

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

2 participants