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

How to create tables and indixes? #45

Open
Vkutovoy92 opened this issue Aug 14, 2024 · 1 comment
Open

How to create tables and indixes? #45

Vkutovoy92 opened this issue Aug 14, 2024 · 1 comment

Comments

@Vkutovoy92
Copy link

I see no instructions how to create new tables and it is not very clear how to create indixes, as example

mongo_api:command(afsts_mongo_master, #{<<"createIndexes">> => <<"merchants">>, <<"indexes">> => [#{<<"key">> => #{<<"public_key">> => 1}, <<"name">> => <<"id_public_key">>}]}, 1000)

Doesn't work

When I use old api with
application:set_env(mongodb, use_legacy_protocol, true),
And
ok = mongo_api:ensure_index(?MASTER, CollectionName, Index)

it gives OK but doesn't create indexes and tables if it is not exist

@Vkutovoy92
Copy link
Author

I have figured out, it looks as
mongo_api:command(afsts_mongo_master, {<<"createIndexes">>, <<"merchants">>, <<"indexes">>, [#{<<"key">> => #{<<"test_index_1">> => 1}, <<"name">> => <<"test_index_1">>}]}, 5000)

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