How to import JSON (1GB) into MongoDB faster?

Replace existing documents in the database with matching documents from the import file. mongoimport will insert all other documents.

A query will be performed on the specified fields, so that’s why an index should exist for them. Otherwise it will be apparently slow.