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 can I create/drop a collection using the driver #255

Open
stretyak opened this issue Nov 5, 2022 · 1 comment
Open

How can I create/drop a collection using the driver #255

stretyak opened this issue Nov 5, 2022 · 1 comment

Comments

@stretyak
Copy link

stretyak commented Nov 5, 2022

I have failed to find a sample
could you please add a sample into readme

@stretyak
Copy link
Author

Found a way

to create

mongoc:transaction(MongoConnection,
	fun(#{pool := Worker}) ->
		Cmd = {<<"create">>, mc_utils:value_to_binary(CollectionName)},
		mc_worker_api:command(Worker,Cmd)
	end, #{}),

to drop

mongoc:transaction(MongoConnection,
	fun(#{pool := Worker}) ->
		Cmd = {<<"create">>, mc_utils:value_to_binary(CollectionName)},
		mc_worker_api:command(Worker,Cmd)
	end, #{}),

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