Joe
Joe

Reputation: 3089

python + mongo issue

I'm playing around with mongodb (documentation isn't very complete):

tmpQuery = collection.find({"title_full": "kdsljfklsadfklj"})
print tmpQuery[0]['title_full']

That just echo's "no such item for Cursor instance", what is an if statement to determine if the variable tmpQuery has a valid result set and not empty?

Upvotes: 0

Views: 2197

Answers (1)

Joe
Joe

Reputation: 3089

oh geez, issue solved with:

tmpQuery.count()

Upvotes: 4

Related Questions