Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pymongo using $exists

I'm new to pymongo and having trouble using exists. When using

collection.find({}, { "cwc": { "$exists": True }})

I get the following error

Unsupported projection option: $exists

What I'm trying to accomplish is to find all _id and cwc where 'cwc' exists and not empty.

like image 993
E liquid Vape Avatar asked Nov 12 '14 19:11

E liquid Vape


1 Answers

This works for me.

collection.find({"cwc":{"$exists":True}})

The only difference is removed the first argument.

like image 68
user4395104 Avatar answered Oct 06 '22 00:10

user4395104