Get documents with field that isn't a particular string

I want to get the documents from MongoDB that don't have the field "name":"John" (just an example).

How can I do this?

For getting the documents that have the field "name":"John" I use:

db.col.find({"name":"John"})

I've already tried ...find(!{"name":"John"}).

db.col.find({"name":{$ne: "John"}})

should work, here are docs: Mongo, Advanced Queries.

Just use $ne selector like this:

db.col.find({"name":{$ne:"John"}})

http://docs.mongodb.org/manual/reference/operator/ne/#_S_ne