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 use "in" operator in find api #214

Open
sammyraul opened this issue Jun 26, 2019 · 1 comment
Open

How to use "in" operator in find api #214

sammyraul opened this issue Jun 26, 2019 · 1 comment

Comments

@sammyraul
Copy link

sammyraul commented Jun 26, 2019

I am trying to query based on multiple identifiers. Similar like below

db.test.find({"_id" : {"$in" : [ObjectId("123"), ObjectId("456")]}})

How can this be achieved using mc_worker_api:find.
Any pointers are really appreciated.
Thanks

@dmsnell
Copy link
Contributor

dmsnell commented Dec 16, 2020

@sammyraul I hope you already found your answer but you can use the API almost identically to your example. the ObjectID instances look different, of course, because they are represented in the bson library differently.

mc_worker_api:find(
	Connection,
	<<"test">>,
	#{<<"_id">> => #{
		<<"$in">> => [
			ObjectId1,
			ObjectId2
		]
	}
).

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