0

I have the following collection in the DB:

[123, 1]
[123, 3]
[456, 1]
[456, 2]
[456, 3]

And I have an array:

[123, 2]
[456, 4]
[456, 2]

I want to check what items in the array are in the DB. Using this example, the result should be:

[456, 2]

Is there any way to do this in Mongodb in bulk, meaning only 1 query instead of looping?

Thanks in advance.

Lale
  • 63
  • 7
  • Maby this helps you: http://stackoverflow.com/questions/18128490/how-to-insert-multiple-documents-at-once-in-mongodb-through-java – Radinator Dec 22 '16 at 23:59
  • A collection can't just hold arrays, what do the documents actually look like? – JohnnyHK Dec 23 '16 at 00:22
  • @Radinator Thanks for your help, although I dont you how that post helps, can you explain further? – Lale Dec 27 '16 at 17:37
  • @johnnyHK Thanks for your help. The document is literally an { byte[], string } where byte[] is a hash and string is some sort of id for something else. – Lale Dec 27 '16 at 17:38

0 Answers0