Cannot query after importing "companies.js"

Hi,

After successfully “mongoimport” the data set in the “companies.js”, the query returns no data at all. Please advise.

PS. I was using MongoDB 3.6.3 on Mac OSX. After upgrading to MongoDB 3.6.7, the problem still persisted. And the problem only happened on the “startups.companies” collection.

Thanks.

use startups
switched to db startups
show collections
campanies
db.companies.findOne()
null
db.companies.findOne({})
null
db.stats()
{
“db” : “startups”,
“collections” : 1,
“views” : 0,
“objects” : 18801,
“avgObjSize” : 3842.1889261209512,
“dataSize” : 72236994,
“storageSize” : 35524608,
“numExtents” : 0,
“indexes” : 1,
“indexSize” : 180224,
“fsUsedSize” : 349987790848,
“fsTotalSize” : 1000240963584,
“ok” : 1
}
db.companies.createIndex({ “description”: “text”, “overview”: “text” })
{
“createdCollectionAutomatically” : true,
“numIndexesBefore” : 1,
“numIndexesAfter” : 2,
“ok” : 1
}
db.companies.findOne()
null
db.companies.aggregate([
… {$match: {"$text": {"$search": “network”} } }] )
db.stats()
{
“db” : “startups”,
“collections” : 2,
“views” : 0,
“objects” : 18801,
“avgObjSize” : 3842.1889261209512,
“dataSize” : 72236994,
“storageSize” : 35528704,
“numExtents” : 0,
“indexes” : 3,
“indexSize” : 188416,
“fsUsedSize” : 349889294336,
“fsTotalSize” : 1000240963584,
“ok” : 1
}

Hi,
It seems you have imported into a collection named “campanies” instead of companies

Regards,
antonio

Hi Antonio,

Yes, that typo was indeed the issue. Thanks very much for pointing it out.

Regards,
McNguyen