NoSQL injections occur when an application retrieves untrusted data and inserts it into a database query without sanitizing it first.