DocumentDB (MongoDB protocol) $in operator bug

Category: azure documentdb


Blunny360 on Thu, 02 Feb 2017 15:50:18


I am having an issue when using the $in operator with DocumentDB (MongoDB protocol). As an example, if I configure my MongoDB/DocumentDB database as follows:

use testdb

db.test.insert({customers: [NumberInt(1),NumberInt(2),NumberInt(3)]})

Next, I use the $in operator to return records that contain the customer with id 1:

db.test.find({customers: {$in:[1]}})

When I run this using MongoDB locally, the single record is returned as expected. When I run exactly the same query against the DocumentDB instance, the result set is empty.

Do you have any ideas?

Many thanks



sivethe on Tue, 07 Feb 2017 18:00:34

Hi Lee,

We need to set a flag on our end to enable this behavior. Please send us your subscriptionId and accountName/username to askdocdbmongoapi[at]Microsoft[dot]com so that we can set the flag on your account.

We will be removing this restriction soon to enable $in/"dot queries on array" on all accounts.