Willian
Willian

Reputation: 2445

Django-mongodb check boolean in raw_query

How to check if a boolean is set to true in a raw_query using django-mongodb.

I'm looking for the equivalent of mongodb's: {'is_bool': true}. I tried:

collection.raw_query({'is_bool': True}) 
# Raises an Exception: 'ObjectId' object has no attribute 'iteritems'

collection.raw_query({'is_bool': 'true'}) 
# Checks if the is_bool is string 'true', so doesn't work either

Upvotes: 1

Views: 396

Answers (1)

Willian
Willian

Reputation: 2445

Oops, my bad!

collection.raw_query({'is_bool': True}) 

Is working, but the exception I got was caused by a faulty value in the db.

Upvotes: 1

Related Questions