The document you provided looks good to me, I also did a simple test with a short version of your document and it works for me.
"_id" : ObjectId("530cb07c009d8c323b477957"),
"time_from" : ISODate("2014-02-25T15:02:20.714Z"),
"checkin" : [
{
"user_id" : 1,
"loc" : {
"type" : "Point",
"coordinates" : [
73.43,
42.22
]
}
}
]
db.testGeo.ensureIndex( { "checkin.loc" : "2dsphere" } );
So I suggest checking other documents in the collection, some of them might be malformed for the index. Also make sure that your coordinates array elements are not strings. Because this document is not valid for 2dsphere index:
"_id" : ObjectId("530cb07c009d8c323b477957"),
"time_from" : ISODate("2014-02-25T15:02:20.714Z"),
"checkin" : [
{
"user_id" : 1,
"loc" : {
"type" : "Point",
"coordinates" : [
"73.43",
"42.22"
]
}
}
]
Please note the quotation marks for the coordinates elements which makes them to be strings.
ANSWER TO THE COMMENT:
Mongo allows only one geospatial index per collection. So you don't have to specify the whole field path for your runCommand. Collection name is enough. This should work for you if the collection name is checkin_20140222
db.runCommand( { geoNear: 'checkin_20140222', near: {type: "Point", coordinates: [73.43, 42.22]}, spherical: true, maxDistance: 40000})
Hope it helps!