java mongodb geonear using query class The 2019 Stack Overflow Developer Survey Results Are InHow to query MongoDB with “like”?MongoDB 'unable to find index for $geoNear query'Mongo (+Mongoose) error: Unable to find index for $geoNear query2dsphere index in MongoDB collection is not fetching in spring JavaUse variables in geonear aggregator in Python Eve with MongoDBMongoDB $geoNear aggregation pipeline (using query option and using $match pipeline operation) giving different no of resultsQuery complains about missing 2dsphere-index, but it's thereLaravel MongoDB : unable to find index for $geoNearHow can i specify the index(key, field) in geoNear (error code: 16604)Unable to find elements by 2sphere
How did passengers keep warm on sail ships?
How to type a long/em dash `—`
Why doesn't UInt have a toDouble()?
Does adding complexity mean a more secure cipher?
Falsification in Math vs Science
Accepted by European university, rejected by all American ones I applied to? Possible reasons?
Pokemon Turn Based battle (Python)
Does HR tell a hiring manager about salary negotiations?
Straighten subgroup lattice
Can there be female White Walkers?
What is this sharp, curved notch on my knife for?
Can I have a signal generator on while it's not connected?
Why not take a picture of a closer black hole?
Correct punctuation for showing a character's confusion
Inverse Relationship Between Precision and Recall
Can an undergraduate be advised by a professor who is very far away?
How to obtain a position of last non-zero element
Are there any other methods to apply to solving simultaneous equations?
Keeping a retro style to sci-fi spaceships?
Can you cast a spell on someone in the Ethereal Plane, if you are on the Material Plane and have the True Seeing spell active?
Is Cinnamon a desktop environment or a window manager? (Or both?)
Getting crown tickets for Statue of Liberty
Likelihood that a superbug or lethal virus could come from a landfill
Can we generate random numbers using irrational numbers like π and e?
java mongodb geonear using query class
The 2019 Stack Overflow Developer Survey Results Are InHow to query MongoDB with “like”?MongoDB 'unable to find index for $geoNear query'Mongo (+Mongoose) error: Unable to find index for $geoNear query2dsphere index in MongoDB collection is not fetching in spring JavaUse variables in geonear aggregator in Python Eve with MongoDBMongoDB $geoNear aggregation pipeline (using query option and using $match pipeline operation) giving different no of resultsQuery complains about missing 2dsphere-index, but it's thereLaravel MongoDB : unable to find index for $geoNearHow can i specify the index(key, field) in geoNear (error code: 16604)Unable to find elements by 2sphere
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am trying to find the documents which are near to a point without using aggregation.I want use NearQuery or Query class or any other.
I tried with following queries but getting exception
1)
NearQuery n=NearQuery.near(user.getLoc().get(0),user.getLoc().get(1));
GeoResults<User> results=mongoTemplate.geoNear(n,User.class,"User4",User.class);
2)
Point point= new Point(77.6672961,13.0257889);
Query query= new Query(Criteria.where("loc").nearSphere(point));
List<User> nearbyusers=mongoTemplate.find(query, User.class,"User4");
3)
Point p=new Point(13.0257889,77.6672961);
Query q=new Query(Criteria.where("loc").near(p));
List<User> i=mongoTemplate.find(q,User.class,"User4");
Exception:
org.springframework.data.mongodb.UncategorizedMongoDbException: Command failed with error 2 (BadValue): 'error processing query: ns=CitizenChat4.User4 limit=100Tree: GEONEAR field=loc maxdist=1.79769e+308 isNearSphere=0
Sort:
Proj: $pt: $meta: "geoNearPoint" , $dis: $meta: "geoNearDistance"
planner returned error: unable to find index for $geoNear query' on server localhost:27017. The full response is "ok" : 0.0, "errmsg" : "error processing query: ns=CitizenChat4.User4 limit=100Tree: GEONEAR field=loc maxdist=1.79769e+308 isNearSphere=0nSort: nProj: $pt: $meta: "geoNearPoint" , $dis: $meta: "geoNearDistance" n planner returned error: unable to find index for $geoNear query", "code" : 2, "codeName" : "BadValue" ; nested exception is com.mongodb.MongoCommandException: Command failed with error 2 (BadValue): 'error processing query: ns=CitizenChat4.User4 limit=100Tree: GEONEAR field=loc maxdist=1.79769e+308 isNearSphere=0
Sort:
Proj: $pt: $meta: "geoNearPoint" , $dis: $meta: "geoNearDistance"
planner returned error: unable to find index for $geoNear query' on server localhost:27017. The full response is "ok" : 0.0, "errmsg" : "error processing query: ns=CitizenChat4.User4 limit=100Tree: GEONEAR field=loc maxdist=1.79769e+308 isNearSphere=0nSort: nProj: $pt: $meta: "geoNearPoint" , $dis: $meta: "geoNearDistance" n planner returned error: unable to find index for $geoNear query", "code" : 2, "codeName" : "BadValue"
at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:138)
at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2756)
at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:510)
User4 collection:
"userID" : "1",
"user_Email" : "ghjkl@gmail.com",
"loc" : [
77.618843,
13.052758
]
"userID" : "2",
"user_Email" : "abc@gmail.com",
"loc" : [
77.618743,
13.054518
]
I have created 2dsphere index on loc attribute in user4 collection.
index:
"v" : 2,
"key" :
"loc" : "2dsphere"
,
"name" : "loc_2dsphere",
"ns" : "CitizenChat4.User4",
"2dsphereIndexVersion" : 3
Please help me.Thankyou
mongodb spring-data-mongodb spring-mongodb spring-mongo mongodb-geospatial
add a comment |
I am trying to find the documents which are near to a point without using aggregation.I want use NearQuery or Query class or any other.
I tried with following queries but getting exception
1)
NearQuery n=NearQuery.near(user.getLoc().get(0),user.getLoc().get(1));
GeoResults<User> results=mongoTemplate.geoNear(n,User.class,"User4",User.class);
2)
Point point= new Point(77.6672961,13.0257889);
Query query= new Query(Criteria.where("loc").nearSphere(point));
List<User> nearbyusers=mongoTemplate.find(query, User.class,"User4");
3)
Point p=new Point(13.0257889,77.6672961);
Query q=new Query(Criteria.where("loc").near(p));
List<User> i=mongoTemplate.find(q,User.class,"User4");
Exception:
org.springframework.data.mongodb.UncategorizedMongoDbException: Command failed with error 2 (BadValue): 'error processing query: ns=CitizenChat4.User4 limit=100Tree: GEONEAR field=loc maxdist=1.79769e+308 isNearSphere=0
Sort:
Proj: $pt: $meta: "geoNearPoint" , $dis: $meta: "geoNearDistance"
planner returned error: unable to find index for $geoNear query' on server localhost:27017. The full response is "ok" : 0.0, "errmsg" : "error processing query: ns=CitizenChat4.User4 limit=100Tree: GEONEAR field=loc maxdist=1.79769e+308 isNearSphere=0nSort: nProj: $pt: $meta: "geoNearPoint" , $dis: $meta: "geoNearDistance" n planner returned error: unable to find index for $geoNear query", "code" : 2, "codeName" : "BadValue" ; nested exception is com.mongodb.MongoCommandException: Command failed with error 2 (BadValue): 'error processing query: ns=CitizenChat4.User4 limit=100Tree: GEONEAR field=loc maxdist=1.79769e+308 isNearSphere=0
Sort:
Proj: $pt: $meta: "geoNearPoint" , $dis: $meta: "geoNearDistance"
planner returned error: unable to find index for $geoNear query' on server localhost:27017. The full response is "ok" : 0.0, "errmsg" : "error processing query: ns=CitizenChat4.User4 limit=100Tree: GEONEAR field=loc maxdist=1.79769e+308 isNearSphere=0nSort: nProj: $pt: $meta: "geoNearPoint" , $dis: $meta: "geoNearDistance" n planner returned error: unable to find index for $geoNear query", "code" : 2, "codeName" : "BadValue"
at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:138)
at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2756)
at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:510)
User4 collection:
"userID" : "1",
"user_Email" : "ghjkl@gmail.com",
"loc" : [
77.618843,
13.052758
]
"userID" : "2",
"user_Email" : "abc@gmail.com",
"loc" : [
77.618743,
13.054518
]
I have created 2dsphere index on loc attribute in user4 collection.
index:
"v" : 2,
"key" :
"loc" : "2dsphere"
,
"name" : "loc_2dsphere",
"ns" : "CitizenChat4.User4",
"2dsphereIndexVersion" : 3
Please help me.Thankyou
mongodb spring-data-mongodb spring-mongodb spring-mongo mongodb-geospatial
add a comment |
I am trying to find the documents which are near to a point without using aggregation.I want use NearQuery or Query class or any other.
I tried with following queries but getting exception
1)
NearQuery n=NearQuery.near(user.getLoc().get(0),user.getLoc().get(1));
GeoResults<User> results=mongoTemplate.geoNear(n,User.class,"User4",User.class);
2)
Point point= new Point(77.6672961,13.0257889);
Query query= new Query(Criteria.where("loc").nearSphere(point));
List<User> nearbyusers=mongoTemplate.find(query, User.class,"User4");
3)
Point p=new Point(13.0257889,77.6672961);
Query q=new Query(Criteria.where("loc").near(p));
List<User> i=mongoTemplate.find(q,User.class,"User4");
Exception:
org.springframework.data.mongodb.UncategorizedMongoDbException: Command failed with error 2 (BadValue): 'error processing query: ns=CitizenChat4.User4 limit=100Tree: GEONEAR field=loc maxdist=1.79769e+308 isNearSphere=0
Sort:
Proj: $pt: $meta: "geoNearPoint" , $dis: $meta: "geoNearDistance"
planner returned error: unable to find index for $geoNear query' on server localhost:27017. The full response is "ok" : 0.0, "errmsg" : "error processing query: ns=CitizenChat4.User4 limit=100Tree: GEONEAR field=loc maxdist=1.79769e+308 isNearSphere=0nSort: nProj: $pt: $meta: "geoNearPoint" , $dis: $meta: "geoNearDistance" n planner returned error: unable to find index for $geoNear query", "code" : 2, "codeName" : "BadValue" ; nested exception is com.mongodb.MongoCommandException: Command failed with error 2 (BadValue): 'error processing query: ns=CitizenChat4.User4 limit=100Tree: GEONEAR field=loc maxdist=1.79769e+308 isNearSphere=0
Sort:
Proj: $pt: $meta: "geoNearPoint" , $dis: $meta: "geoNearDistance"
planner returned error: unable to find index for $geoNear query' on server localhost:27017. The full response is "ok" : 0.0, "errmsg" : "error processing query: ns=CitizenChat4.User4 limit=100Tree: GEONEAR field=loc maxdist=1.79769e+308 isNearSphere=0nSort: nProj: $pt: $meta: "geoNearPoint" , $dis: $meta: "geoNearDistance" n planner returned error: unable to find index for $geoNear query", "code" : 2, "codeName" : "BadValue"
at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:138)
at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2756)
at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:510)
User4 collection:
"userID" : "1",
"user_Email" : "ghjkl@gmail.com",
"loc" : [
77.618843,
13.052758
]
"userID" : "2",
"user_Email" : "abc@gmail.com",
"loc" : [
77.618743,
13.054518
]
I have created 2dsphere index on loc attribute in user4 collection.
index:
"v" : 2,
"key" :
"loc" : "2dsphere"
,
"name" : "loc_2dsphere",
"ns" : "CitizenChat4.User4",
"2dsphereIndexVersion" : 3
Please help me.Thankyou
mongodb spring-data-mongodb spring-mongodb spring-mongo mongodb-geospatial
I am trying to find the documents which are near to a point without using aggregation.I want use NearQuery or Query class or any other.
I tried with following queries but getting exception
1)
NearQuery n=NearQuery.near(user.getLoc().get(0),user.getLoc().get(1));
GeoResults<User> results=mongoTemplate.geoNear(n,User.class,"User4",User.class);
2)
Point point= new Point(77.6672961,13.0257889);
Query query= new Query(Criteria.where("loc").nearSphere(point));
List<User> nearbyusers=mongoTemplate.find(query, User.class,"User4");
3)
Point p=new Point(13.0257889,77.6672961);
Query q=new Query(Criteria.where("loc").near(p));
List<User> i=mongoTemplate.find(q,User.class,"User4");
Exception:
org.springframework.data.mongodb.UncategorizedMongoDbException: Command failed with error 2 (BadValue): 'error processing query: ns=CitizenChat4.User4 limit=100Tree: GEONEAR field=loc maxdist=1.79769e+308 isNearSphere=0
Sort:
Proj: $pt: $meta: "geoNearPoint" , $dis: $meta: "geoNearDistance"
planner returned error: unable to find index for $geoNear query' on server localhost:27017. The full response is "ok" : 0.0, "errmsg" : "error processing query: ns=CitizenChat4.User4 limit=100Tree: GEONEAR field=loc maxdist=1.79769e+308 isNearSphere=0nSort: nProj: $pt: $meta: "geoNearPoint" , $dis: $meta: "geoNearDistance" n planner returned error: unable to find index for $geoNear query", "code" : 2, "codeName" : "BadValue" ; nested exception is com.mongodb.MongoCommandException: Command failed with error 2 (BadValue): 'error processing query: ns=CitizenChat4.User4 limit=100Tree: GEONEAR field=loc maxdist=1.79769e+308 isNearSphere=0
Sort:
Proj: $pt: $meta: "geoNearPoint" , $dis: $meta: "geoNearDistance"
planner returned error: unable to find index for $geoNear query' on server localhost:27017. The full response is "ok" : 0.0, "errmsg" : "error processing query: ns=CitizenChat4.User4 limit=100Tree: GEONEAR field=loc maxdist=1.79769e+308 isNearSphere=0nSort: nProj: $pt: $meta: "geoNearPoint" , $dis: $meta: "geoNearDistance" n planner returned error: unable to find index for $geoNear query", "code" : 2, "codeName" : "BadValue"
at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:138)
at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2756)
at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:510)
User4 collection:
"userID" : "1",
"user_Email" : "ghjkl@gmail.com",
"loc" : [
77.618843,
13.052758
]
"userID" : "2",
"user_Email" : "abc@gmail.com",
"loc" : [
77.618743,
13.054518
]
I have created 2dsphere index on loc attribute in user4 collection.
index:
"v" : 2,
"key" :
"loc" : "2dsphere"
,
"name" : "loc_2dsphere",
"ns" : "CitizenChat4.User4",
"2dsphereIndexVersion" : 3
Please help me.Thankyou
mongodb spring-data-mongodb spring-mongodb spring-mongo mongodb-geospatial
mongodb spring-data-mongodb spring-mongodb spring-mongo mongodb-geospatial
asked Mar 8 at 11:07
nithinnithin
647
647
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55061923%2fjava-mongodb-geonear-using-query-class%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55061923%2fjava-mongodb-geonear-using-query-class%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown