Query with Type not Equal in mongodb

Viewed 13747

im doing the following query which work perfectly and brings me the part of the documents that complies the type filter

db.users.find({phoneNumber:/^\+/, devices:{$exists:true, $type:3}});

However im trying to get all the devices that exists but are not type 3 (object), i could go trying each type [http://docs.mongodb.org/manual/reference/operator/query/type/], but wanted to know if it is possible to negate type 3 i tried

db.users.count({phoneNumber:/^\+/, devices:{$exists:true, $type: { $neq: 3}}});
db.users.count({phoneNumber:/^\+/, devices:{$exists:true, $type: { $not: 3}}});
db.users.count({phoneNumber:/^\+/, devices:{$exists:true, $type: { $not: {$eq:3}}}});

But all of them throw the same exception

exception: type not supported for appendMinElementForType

Any clues on how to do this query?

1 Answers
Related