I can see photos on the Google+ Places Pages, but it's those pictures are not retrieved within the Google API Places Details json response. Not all places, but some places are showing this behavior. As an example, I'll give you the Google+ Page for an Hotel and show you the json response retrieved:
Google+ Page
https://plus.google.com/104205878124399481073/about
{
"debug_info" : [],
"html_attributions" : [],
"result" : {
"address_components" : [
{
"long_name" : "Ret. 3 Lotes 12 y 13",
"short_name" : "Ret. 3 Lotes 12 y 13",
"types" : [ "street_number" ]
},
{
"long_name" : "Paseo Xaman-ha",
"short_name" : "Paseo Xaman-ha",
"types" : [ "route" ]
},
{
"long_name" : "Villas Pakal",
"short_name" : "Villas Pakal",
"types" : [ "sublocality", "political" ]
},
{
"long_name" : "Playa del Carmen",
"short_name" : "Playa del Carmen",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Quintana Roo",
"short_name" : "Quintana Roo",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "MX",
"short_name" : "MX",
"types" : [ "country", "political" ]
},
{
"long_name" : "77710",
"short_name" : "77710",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "Paseo Xaman-ha Ret. 3 Lotes 12 y 13, Villas Pakal, Playa del Carmen, Quintana Roo, México",
"formatted_phone_number" : "01 984 803 1585",
"geometry" : {
"location" : {
"lat" : 25.855920,
"lng" : -97.4760320
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/lodging-71.png",
"id" : "98e0009b05c90782c18e8c12273d651c0dde3d5a",
"international_phone_number" : "+52 984 803 1585",
"name" : "Hotel Hacienda Vista Real",
"opening_hours" : {
"open_now" : true,
"periods" : [
{
"close" : {
"day" : 0,
"time" : "2359"
},
"open" : {
"day" : 0,
"time" : "0000"
}
},
{
"close" : {
"day" : 1,
"time" : "2359"
},
"open" : {
"day" : 1,
"time" : "0000"
}
},
{
"close" : {
"day" : 2,
"time" : "2359"
},
"open" : {
"day" : 2,
"time" : "0000"
}
},
{
"close" : {
"day" : 3,
"time" : "2359"
},
"open" : {
"day" : 3,
"time" : "0000"
}
},
{
"close" : {
"day" : 4,
"time" : "2359"
},
"open" : {
"day" : 4,
"time" : "0000"
}
},
{
"close" : {
"day" : 5,
"time" : "2359"
},
"open" : {
"day" : 5,
"time" : "0000"
}
},
{
"close" : {
"day" : 6,
"time" : "2359"
},
"open" : {
"day" : 6,
"time" : "0000"
}
}
]
},
"reference" : "CoQBdwAAALAyGQMoVRlq-UMhh0CFSKHKyHFI4jbA_H5zhwCK5r9haJFCgx7Y0Ql_rWiSap3Tao6QHpfRaKy3dpmaOuwkLCuNeoeVRhkWZWHIb_kN0phGdg1-CbJp3au7KKq8_C8LHYccrYg6sPYDSs7nblWh_xvbbNHtf2N30O_YppCjQp8BEhBKMZnaMDqKN3LMOddPNlpyGhTL3mQ_-HM5r2893_pWitrdOcX6vQ",
"reviews" : [
{
"aspects" : [
{
"rating" : 1,
"type" : "quality"
},
{
"rating" : 1,
"type" : "facilities"
},
{
"rating" : 2,
"type" : "service"
}
],
"author_name" : "Yuri Diana Mateos",
"author_url" : "https://plus.google.com/105503150293220587391",
"text" : "Incribisisisimo el paseo chido quien bota por jaltipan",
"time" : 1366422681
}
],
"types" : [ "lodging", "establishment" ],
"url" : "https://plus.google.com/104205878124399481073/about?hl=en-US",
"utc_offset" : -300,
"vicinity" : "Paseo Xaman-ha Ret. 3 Lotes 12 y 13, Villas Pakal, Playa del Carmen",
"website" : "http://www.eurostarshaciendavistareal.com/"
},
"status" : "OK"
}
You appear to be doing everything correctly, but the data simply isn't there. You might create a defect issue (if this hasn't already been reported) so that they know about the problem and can look into it.
https://code.google.com/p/gmaps-api-issues/issues/list
Related
I have a gltf in which I apply png textures on rectangular mesh. I have a rectangle png and circle png. rectangle node is at z = 0.01 and circle at z = 0.0. alpha mode used for the materials is BLEND. material is double sided.
GLTF
{
"scenes" : [
{
"nodes" : [
0
]
}
],
"nodes" : [
{
"name" : "Node_0",
"children" : [
1,
3
]
},
{
"name" : "Symbol 2",
"children" : [
2
],
"translation" : [
240.25,
-126.300003,
0
]
},
{
"name" : "Node_2",
"mesh" : 0,
"scale" : [
0.656657,
0.656657,
1
]
},
{
"name" : "Symbol 1",
"children" : [
4
],
"translation" : [
170,
-89.050003,
0
]
},
{
"name" : "Node_4",
"mesh" : 1,
"translation" : [
0,
0,
-0.01
],
"scale" : [
2.059968,
1.399979,
1
]
}
],
"meshes" : [
{
"primitives" : [
{
"attributes" : {
"POSITION" : 1,
"TEXCOORD_0" : 2
},
"indices" : 0,
"material" : 0
}
]
},
{
"primitives" : [
{
"attributes" : {
"POSITION" : 1,
"TEXCOORD_0" : 2
},
"indices" : 0,
"material" : 1
}
]
}
],
"buffers" : [
{
"uri" : "data:application/octet-stream;base64,AQAAAAAAAAADAAAAAwAAAAIAAAABAAAAAAAAAAAAAIAAAAAAAAAAAAAAyMIAAAAAAADIQgAAyMIAAAAAAADIQgAAAIAAAAAAAAAAAAAAAAAAAAAAAACAPwAAgD8AAIA/AACAPwAAAAAAAAAAq6oqPacaKD+nGig/AACAP6caKD+nGig/AACAPwAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAACAAACAPwAAAACrqio9AACAPwAAgD8AAIA/AACAPwAAgD8AAIA/AAAAAABAcEOamfzCAAAAAAAAAAAAAAAAAAAAAAAAAIAAAIA/AAAAAKuqKj2G1gNAfzKzPwAAgD+G1gNAfzKzPwAAgD8AAAAAAAAAAAAAAIAK1yO8AAAAAAAAAAAAAAAAAAAAgAAAgD8AAAAAq6oqPQAAgD8AAIA/AACAPwAAgD8AAIA/AACAPwAAAAAAACpDmhmywgAAAAAAAAAAAAAAAAAAAAAAAACAAACAPw==",
"byteLength" : 376
}
],
"bufferViews" : [
{
"buffer" : 0,
"byteOffset" : 0,
"byteLength" : 24,
"target" : 34963
},
{
"buffer" : 0,
"byteOffset" : 24,
"byteLength" : 48,
"target" : 34962
},
{
"buffer" : 0,
"byteOffset" : 72,
"byteLength" : 32,
"target" : 34962
}
],
"accessors" : [
{
"name" : "accessor_0",
"bufferView" : 0,
"byteOffset" : 0,
"componentType" : 5125,
"count" : 6,
"type" : "SCALAR",
"max" : [
3
],
"min" : [
0
]
},
{
"name" : "accessor_1",
"bufferView" : 1,
"byteOffset" : 0,
"componentType" : 5126,
"count" : 4,
"type" : "VEC3",
"max" : [
100,
0,
0
],
"min" : [
0,
-100,
0
]
},
{
"name" : "accessor_2",
"bufferView" : 2,
"byteOffset" : 0,
"componentType" : 5126,
"count" : 4,
"type" : "VEC2",
"max" : [
1,
1
],
"min" : [
0,
0
]
}
],
"materials" : [
{
"pbrMetallicRoughness" : {
"baseColorTexture" : {
"index" : 0
}
},
"alphaMode" : "BLEND",
"doubleSided" : true
},
{
"pbrMetallicRoughness" : {
"baseColorTexture" : {
"index" : 1
}
},
"alphaMode" : "BLEND",
"doubleSided" : true
}
],
"samplers" : [
{
"magFilter" : 9729,
"minFilter" : 9987,
"wrapS" : 33071,
"wrapT" : 33071
}
],
"textures" : [
{
"sampler" : 0,
"source" : 0
},
{
"sampler" : 0,
"source" : 1
}
],
"images" : [
{
"uri" : "Image0.png"
},
{
"uri" : "Image1.png"
}
],
"asset" : {
"version" : "2.0"
}
}
PNGs
I am using ThreeJs gltf viewer. https://gltf-viewer.donmccurdy.com/
blending works fine at some angles but when i rotate around some angles blending does not work. screenshots
Can Someone explain this behaviour to me and how can i achieve correct blending at all angles.
If these are three separate nodes, and they all live at 0,0,0 you might have a sorting problem. GLTF is readable, but I'm not as familiar with the spec to tell what is going on. The nodes mentioned in the file that do not have a translation field, might all be positioned at 0,0,0
Either way, the remedy for something like this, if you want to keep sorting is to assign a different yourMesh.renderOrder = yourDesiredOrder. So for these elements you could set 1,2,3,4... and control when you want them to draw / tell the sorting to consider these weights.
I have the following aggregation done in a MongoDB shell to get the number of alerts of each type for each user:
db.getCollection('alerts').aggregate(
{
$unwind:"$son"
},
{
$group:
{
_id:{
son: "$son",
level: "$level"
},
count: { $sum: 1 }
}
},
{
$group:
{
_id:{
son: "$_id.son"
},
alerts: { $addToSet: {
level: "$_id.level",
count: "$count"
}}
}
}
)
I have translated it to Spring Data MongoDB as follows:
TypedAggregation<AlertEntity> alertsAggregation =
Aggregation.newAggregation(AlertEntity.class,
unwind("$son"),
Aggregation.group("$son", "$level").count().as("count"),
Aggregation.group("$_id.son")
.addToSet(new BasicDBObject("level", "$_id.level").append("count", "$count")).as("alerts"));
// Aggregation.match(Criteria.where("_id").in(sonIds)
AggregationResults<AlertsBySonDTO> results = mongoTemplate.
aggregate(alertsAggregation, AlertsBySonDTO.class);
List<AlertsBySonDTO> alertsBySonResultsList = results.getMappedResults();
return alertsBySonResultsList;
What I have not clear and I can not get it to work, is to project the identifier and if possible the name of the user (son variable).
The resulting DTO is as follows
public final class AlertsBySonDTO implements Serializable {
private static final long serialVersionUID = 1L;
#JsonProperty("identity")
private String id;
#JsonProperty("alerts")
private ArrayList<Map<String, String>> alerts;
}
but in the id property the entire embedded child entity.
This is the structure of the collection of alerts.
JSON alerts format:
{
"_id" : ObjectId("59e6ff3d9ef9d46a91112890"),
"_class" : "es.bisite.usal.bulltect.persistence.entity.AlertEntity",
"level" : "INFO",
"title" : "Alerta de Prueba",
"payload" : "Alerta de Prueba",
"create_at" : ISODate("2017-10-18T07:13:45.091Z"),
"delivery_mode" : "PUSH_NOTIFICATION",
"delivered" : false,
"parent" : {
"$ref" : "parents",
"$id" : ObjectId("59e6ff369ef9d46a91112878")
},
"son" : {
"$ref" : "children",
"$id" : ObjectId("59e6ff389ef9d46a9111287b")
}
}
/* 2 */
{
"_id" : ObjectId("59e6ff6d9ef9d46a91112892"),
"_class" : "es.bisite.usal.bulltect.persistence.entity.AlertEntity",
"level" : "WARNING",
"title" : "Token de acceso inv�lido.",
"payload" : "El token de acceso YOUTUBE no es v�lido",
"create_at" : ISODate("2017-10-18T07:14:53.449Z"),
"delivery_mode" : "PUSH_NOTIFICATION",
"delivered" : false,
"parent" : {
"$ref" : "parents",
"$id" : ObjectId("59e6ff369ef9d46a91112878")
},
"son" : {
"$ref" : "children",
"$id" : ObjectId("59e6ff389ef9d46a9111287b")
}
}
/* 3 */
{
"_id" : ObjectId("59e6ff6d9ef9d46a91112893"),
"_class" : "es.bisite.usal.bulltect.persistence.entity.AlertEntity",
"level" : "WARNING",
"title" : "Token de acceso inv�lido.",
"payload" : "El token de acceso INSTAGRAM no es v�lido",
"create_at" : ISODate("2017-10-18T07:14:53.468Z"),
"delivery_mode" : "PUSH_NOTIFICATION",
"delivered" : false,
"parent" : {
"$ref" : "parents",
"$id" : ObjectId("59e6ff369ef9d46a91112878")
},
"son" : {
"$ref" : "children",
"$id" : ObjectId("59e6ff389ef9d46a9111287c")
}
}
Anyone know how I can approach this?
thanks in advance
1. With MongoDB version 3.4
These are the following collections I created to reproduce your use case:
Alerts Collection
{
"_id" : ObjectId("59e6ff3d9ef9d46a91112890"),
"_class" : "es.bisite.usal.bulltect.persistence.entity.AlertEntity",
"level" : "INFO",
"title" : "Alerta de Prueba",
"payload" : "Alerta de Prueba",
"create_at" : ISODate("2017-10-18T07:13:45.091+0000"),
"delivery_mode" : "PUSH_NOTIFICATION",
"delivered" : false,
"parent" : DBRef("parents", ObjectId("59e6ff369ef9d46a91112878")),
"son" : DBRef("children", ObjectId("59e72ff0572ae72d8c063666"))
}
{
"_id" : ObjectId("59e6ff6d9ef9d46a91112892"),
"_class" : "es.bisite.usal.bulltect.persistence.entity.AlertEntity",
"level" : "WARNING",
"title" : "Token de acceso inv�lido.",
"payload" : "El token de acceso YOUTUBE no es valido",
"create_at" : ISODate("2017-10-18T07:14:53.449+0000"),
"delivery_mode" : "PUSH_NOTIFICATION",
"delivered" : false,
"parent" : DBRef("parents", ObjectId("59e6ff369ef9d46a91112878")),
"son" : DBRef("children", ObjectId("59e72ff0572ae72d8c063666"))
}
{
"_id" : ObjectId("59e6ff6d9ef9d46a91112893"),
"_class" : "es.bisite.usal.bulltect.persistence.entity.AlertEntity",
"level" : "WARNING",
"title" : "Token de acceso inv�lido.",
"payload" : "El token de acceso INSTAGRAM no es v�lido",
"create_at" : ISODate("2017-10-18T07:14:53.468+0000"),
"delivery_mode" : "PUSH_NOTIFICATION",
"delivered" : false,
"parent" : DBRef("parents", ObjectId("59e6ff369ef9d46a91112878")),
"son" : DBRef("children", ObjectId("59e72ffb572ae72d8c063669"))
}
Notice I changed the OBjectIds of the sons reference to match the children collection I created.
Children collection
{
"_id" : ObjectId("59e72ff0572ae72d8c063666"),
"name" : "Bob"
}
{
"_id" : ObjectId("59e72ffb572ae72d8c063669"),
"name" : "Tim"
}
Since you are using a reference you can't just access a field from the other collection. So I think you are missing some aggregation steps.
I did the following:
db.getCollection('alerts').aggregate(
{
$unwind:"$son"
},
{
$group:
{
_id:{
son: "$son",
level: "$level"
},
count: { $sum: 1 }
}
},
{
$group:
{
_id:{
son: "$_id.son"
},
alerts: { $addToSet: {
level: "$_id.level",
count: "$count"
}}
}
},
{ $addFields: { sonsArray: { $objectToArray: "$_id.son" } } },
{ $match: { "sonsArray.k": "$id"} },
{ $lookup: { from: "children", localField: "sonsArray.v", foreignField: "_id", as: "name" } }
)
And got the following results as json:
{
"_id" : {
"son" : DBRef("children", ObjectId("59e72ffb572ae72d8c063669"))
},
"alerts" : [
{
"level" : "WARNING",
"count" : NumberInt(1)
}
],
"sonsArray" : [
{
"k" : "$ref",
"v" : "children"
},
{
"k" : "$id",
"v" : ObjectId("59e72ffb572ae72d8c063669")
}
],
"name" : [
{
"_id" : ObjectId("59e72ffb572ae72d8c063669"),
"name" : "Tim"
}
]
}
{
"_id" : {
"son" : DBRef("children", ObjectId("59e72ff0572ae72d8c063666"))
},
"alerts" : [
{
"level" : "INFO",
"count" : NumberInt(1)
},
{
"level" : "WARNING",
"count" : NumberInt(1)
}
],
"sonsArray" : [
{
"k" : "$ref",
"v" : "children"
},
{
"k" : "$id",
"v" : ObjectId("59e72ff0572ae72d8c063666")
}
],
"name" : [
{
"_id" : ObjectId("59e72ff0572ae72d8c063666"),
"name" : "Bob"
}
]
}
If you want to get rid of the fields that where additionally created like sonsArray etc. you can do add a $project pipeline to clean your result.
2. If you have older versions of mongodb and you can change your data structure.
If instead of using a reference like this:
"son" : DBRef("children", ObjectId("59e72ffb572ae72d8c063669"))
you can add the objectId of the son/s as an array like this:
"sonId" : [
ObjectId("59e72ff0572ae72d8c063666")
]
then you can do your aggregation as follows:
db.getCollection('alerts').aggregate(
{
$unwind:"$sonId"
},
{
$group:
{
_id:{
sonId: "$sonId",
level: "$level"
},
count: { $sum: 1 }
}
},
{
$group:
{
_id:{
sonId: "$_id.sonId"
},
alerts: { $addToSet: {
level: "$_id.level",
count: "$count"
}}
}
},
{ $lookup: { from: "children", localField: "_id.sonId", foreignField: "_id", as: "son" } }
)
Is that something you are looking for?
I have the following aggregation query in MongoDB
return mongoose.model('Submission')
.aggregate([
{ $match: { client: { $in: clientIds }, admin: this._admin._id } },
{ $sort: { client: 1, submitted: -1 } },
{ $group: {
_id: '$client',
lastSubmitted: { $first: '$submitted' },
timezone: { $first: '$timezone' },
} },
])
.exec();
which is performing really badly on a collection with about 2000 documents. It usually takes 5 seconds to complete and I've seen as bad as 15 seconds. I have the following index on the submissions collection:
{
client : 1,
admin : 1,
assessment : 1,
submitted : -1,
}
I'm stuck as to why it's taking so long. Any suggestions?
EDIT
I've run the query
db.submissions.aggregate([
{$match: {
client: {$in: ['54a4cdfdd0666c243035dc98','55cc985291a0ffab6849de34']},
admin: '542b4af8880fc300007eb411'
}},
{$sort: {client:1, submitted: -1}},
{$group: {
_id: '$client',
lastSubmitted: {$first: '$submitted'},
timezone: {$first: '$timezone'}
}}
], {explain: true})
in the shell with explain and got
{
"stages" : [
{
"$cursor" : {
"query" : {
"client" : {
"$in" : [
"54a4cdfdd0666c243035dc98",
"55cc985291a0ffab6849de34"
]
},
"admin" : "542b4af8880fc300007eb411"
},
"fields" : {
"client" : 1,
"submitted" : 1,
"timezone" : 1,
"_id" : 0
},
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "webdemo.submissions",
"indexFilterSet" : false,
"parsedQuery" : {
"$and" : [
{
"admin" : {
"$eq" : "542b4af8880fc300007eb411"
}
},
{
"client" : {
"$in" : [
"54a4cdfdd0666c243035dc98",
"55cc985291a0ffab6849de34"
]
}
}
]
},
"winningPlan" : {
"stage" : "FETCH",
"inputStage" : {
"stage" : "IXSCAN",
"keyPattern" : {
"client" : 1,
"admin" : 1,
"assessment" : 1,
"submitted" : -1
},
"indexName" : "client_1_admin_1_assessment_1_submitted_-1",
"isMultiKey" : false,
"direction" : "forward",
"indexBounds" : {
"client" : [
"[\"54a4cdfdd0666c243035dc98\", \"54a4cdfdd0666c243035dc98\"]",
"[\"55cc985291a0ffab6849de34\", \"55cc985291a0ffab6849de34\"]"
],
"admin" : [
"[\"542b4af8880fc300007eb411\", \"542b4af8880fc300007eb411\"]"
],
"assessment" : [
"[MinKey, MaxKey]"
],
"submitted" : [
"[MaxKey, MinKey]"
]
}
}
},
"rejectedPlans" : [ ]
}
}
},
{
"$sort" : {
"sortKey" : {
"client" : 1,
"submitted" : -1
}
}
},
{
"$group" : {
"_id" : "$client",
"lastSubmitted" : {
"$first" : "$submitted"
},
"timezone" : {
"$first" : "$timezone"
}
}
}
],
"ok" : 1
}
EDIT 2
The output I get from db.submissions.getIndices() is
[
{
"v" : 1,
"key" : {
"_id" : 1
},
"name" : "_id_",
"ns" : "webdemo.submissions"
},
{
"v" : 1,
"key" : {
"client" : 1,
"admin" : 1,
"assessment" : 1,
"submitted" : -1
},
"name" : "client_1_admin_1_assessment_1_submitted_-1",
"ns" : "webdemo.submissions",
"background" : true
}
]
When I perform a Google Places Autocomplete request for "98 Spru" I get a Place prediction with one id (013ae3e513081ff1bc9e3dc202df54ba9d147285) and one set of types ("route" and "geocode") but when I fetch for the details of that Place it has a different id (5e66bbb5a5a7eaedd07fabc199e87570bcc0eae6) and a different set of types ("street_address")? The rest of the information is correct. Snippets of requests / responses below.
Is this expected and if so why?
On the client side I'm trying to filter out Autocomplete predictions that are not of some specific type (e.g. "street_address"). This doesn't work since the "types" field in the Autocomplete response doesn't consistently match the "true" types value as returned in the Details response.
Thanks!
Autocomplete Request / Response for "98 Spru"
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=98%20Spru&sensor=true&key=MYKEY&location=42.350000,-71.160000&radius=100.000000&types=geocode
{
"description" : "98 Spruce Street, Watertown, MA, United States",
"id" : "013ae3e513081ff1bc9e3dc202df54ba9d147285",
"matched_substrings" : [
{
"length" : 7,
"offset" : 0
}
],
"reference" : "CmRcAAAArJjcgqYuczq9wKmQG0lwv6j_uCBYCrWzS_U76FvnV3fCnWq0_pPf-nu6M9eTYQEpYt4XahA3Vg0GSzMcR23k3Mkxp9sv73ObGmeHDcanEnZ0dWpl69t7eSwmzLbrREQfEhA0CrWTEXtfQhcnfNWnqTukGhQFWBj_lPkoAwG-ZvUIv0GZhgAscQ",
"terms" : [
{
"offset" : 0,
"value" : "98 Spruce Street"
},
{
"offset" : 18,
"value" : "Watertown"
},
{
"offset" : 29,
"value" : "MA"
},
{
"offset" : 33,
"value" : "United States"
}
],
"types" : [ "route", "geocode" ]
},
Details Request / Response from above prediction:
https://maps.googleapis.com/maps/api/place/details/json?key=MYKEY&sensor=true&reference=CmRcAAAAzcupmv2dCaIWTnySJhA8y4BIc5_VSj1AUXCBFHEVnuo3NGjuqAVrLGSVZ_NODQstUs1ZclGASEzBYTF0B1nFSAcjgrc7Jn9NhJC2GZ2RtQQ3REFV7pvBzTPoGOHew289EhAD7dQFOe2EvBjpQ46IKODbGhTH0scvHs54U3refjf1-Tn6-04XvQ
{
"debug_info" : [],
"html_attributions" : [],
"result" : {
"address_components" : [
{
"long_name" : "98",
"short_name" : "98",
"types" : [ "street_number" ]
},
{
"long_name" : "Spruce St",
"short_name" : "Spruce St",
"types" : [ "route" ]
},
{
"long_name" : "Watertown",
"short_name" : "Watertown",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Middlesex",
"short_name" : "Middlesex",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Massachusetts",
"short_name" : "MA",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
},
{
"long_name" : "02472",
"short_name" : "02472",
"types" : [ "postal_code" ]
}
],
"adr_address" : "\u003cspan class=\"street-address\"\u003e98 Spruce St\u003c/span\u003e, \u003cspan class=\"locality\"\u003eWatertown\u003c/span\u003e, \u003cspan class=\"region\"\u003eMA\u003c/span\u003e \u003cspan class=\"postal-code\"\u003e02472\u003c/span\u003e, \u003cspan class=\"country-name\"\u003eUSA\u003c/span\u003e",
"formatted_address" : "98 Spruce St, Watertown, MA 02472, USA",
"geometry" : {
"location" : {
"lat" : 42.3667790,
"lng" : -71.1698590
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png",
"id" : "5e66bbb5a5a7eaedd07fabc199e87570bcc0eae6",
"name" : "98 Spruce St",
"reference" : "CpQBhgAAABX6gm9Qh9r9QxMuEWIrwFGcsz2QnUG0MAoEkD33kwrxfcEakZh-d01oWlAFnIieF8MvVcflI7xJ91Qq2ahnw9oDjcUPUnhlRcOUjLF0lTXOWf3Fp3dbCqLo3MQxCDGT3UJj5fR4ZrPagqBYXtQcPl1TB6sgPHZv8x-2jdJzbh-yZ6yb9VhfG-KDD76-RdotkRIQ7Oz0mKuwaclr0xiIf4oHehoUM2l9nZsi5pU2RPyB7YA2lmJ7vI0",
"types" : [ "street_address" ],
"url" : "https://maps.google.com/maps/place?q=98+Spruce+St&ftid=0x89e3781f4bba528d:0xa7ec6e9a6bde2e4f",
"vicinity" : "Watertown"
},
"status" : "OK"
}
You can't rely on the googleId thats returned by the autocomplete API. You need to use the reference, make an API call to Place Details API, then use that ID. I believe sometimes Google will consolidate their places database such that the reference will 'redirect' to a new place.
I am using FindAndModify in MongoDB in several concurrent processes. The collection size is about 3 million entries and everything works like a blast as long as I don't pass a sorting option (by an indexed field). Once I try to do so, the following warning is spawned to the logs:
warning: ClientCursor::yield can't unlock b/c of recursive lock ns: test_db.wengine_queue top:
{
opid: 424210,
active: true,
lockType: "write",
waitingForLock: false,
secs_running: 0,
op: "query",
ns: "test_db",
query: {
findAndModify: "wengine_queue",
query: {
locked: { $ne: 1 },
rule_completed: { $in: [ "", "0", null ] },
execute_at: { $lt: 1324381363 },
company_id: 23,
debug: 0,
system_id: "AK/AK1201"
},
update: {
$set: { locked: 1 }
},
sort: {
execute_at: -1
}
},
client: "127.0.0.1:60873",
desc: "conn",
threadId: "0x1541bb000",
connectionId: 1147,
numYields: 0
}
I do have all the keys from the query indexed, here they are:
PRIMARY> db.wengine_queue.getIndexes()
[
{
"v" : 1,
"key" : {
"_id" : 1
},
"ns" : "test_db.wengine_queue",
"name" : "_id_"
},
{
"v" : 1,
"key" : {
"system_id" : 1,
"company_id" : 1,
"locked" : 1,
"rule_completed" : 1,
"execute_at" : -1,
"debug" : 1
},
"ns" : "test_db.wengine_queue",
"name" : "system_id_1_company_id_1_locked_1_rule_completed_1_execute_at_-1_debug_1"
},
{
"v" : 1,
"key" : {
"debug" : 1
},
"ns" : "test_db.wengine_queue",
"name" : "debug_1"
},
{
"v" : 1,
"key" : {
"system_id" : 1
},
"ns" : "test_db.wengine_queue",
"name" : "system_id_1"
},
{
"v" : 1,
"key" : {
"company_id" : 1
},
"ns" : "test_db.wengine_queue",
"name" : "company_id_1"
},
{
"v" : 1,
"key" : {
"locked" : 1
},
"ns" : "test_db.wengine_queue",
"name" : "locked_1"
},
{
"v" : 1,
"key" : {
"rule_completed" : 1
},
"ns" : "test_db.wengine_queue",
"name" : "rule_completed_1"
},
{
"v" : 1,
"key" : {
"execute_at" : -1
},
"ns" : "test_db.wengine_queue",
"name" : "execute_at_-1"
},
{
"v" : 1,
"key" : {
"thread_id" : 1
},
"ns" : "test_db.wengine_queue",
"name" : "thread_id_1"
},
{
"v" : 1,
"key" : {
"rule_id" : 1
},
"ns" : "test_db.wengine_queue",
"name" : "rule_id_1"
}
]
Is there any way around this?
For those interested -- I had to create a separate index ending with the key that the set is to be sorted by.
That warning is thrown when an operation that wants to yield (such as long updates, removes, etc.) cannot do so because it cannot release the lock it's holding for whatever reason.
Do you have the field you're sorting on indexed? If not adding an index for that will probably remove the warnings.