我花了这么直接的事情.我只想使用nodejs,mongoose,restify stack对用户模型进行CRUD操作.我的mongo实例是在mongolab上.用户应包含"loc"字段.用户架构如下:
var mongoose = require('mongoose')
var Schema = mongoose.Schema;
var userSchema = new Schema( {
email_id : { type: String, unique: true },
password: { type: String},
first_name: String,
last_name: String,
age: String,
phone_number: String,
profile_picture: String,
loc: {
type: {},
coordinates: [Number]
}
});
userSchema.index({loc:'2d'});
var User = mongoose.model('user', userSchema);
module.exports = User;
Run Code Online (Sandbox Code Playgroud)
其余api用于发布如下:
create_user : function (req, res, next) {
var coords = [];
coords[0] = req.query.longitude;
coords[1] = req.query.latitude;
var user = new User(
{
email_id …Run Code Online (Sandbox Code Playgroud) 我想做一个非常简单的事情,这是几天前工作的.
CloseableHttpClient client = HttpClientBuilder.create().build();
HttpGet get = new HttpGet(url);
HttpResponse response = client.execute(get);
Run Code Online (Sandbox Code Playgroud)
它给出了以下错误
Caused by:
java.lang.IllegalStateException: Unsupported cookie spec: default
at org.apache.http.cookie.CookieSpecRegistry.getCookieSpec(CookieSpecRegistry.java:110)
at org.apache.http.cookie.CookieSpecRegistry$1.create(CookieSpecRegistry.java:163)
at org.apache.http.client.protocol.RequestAddCookies.process(RequestAddCookies.java:157)
at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:132)
at org.apache.http.protocol.HttpRequestExecutor.preProcess(HttpRequestExecutor.java:166)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:485)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:878)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:84)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:109)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
Run Code Online (Sandbox Code Playgroud)
我之前使用已弃用的客户端遇到此错误,并将其更改为使用HTTPClientBuilder.我不确定为什么它会给HTTPGet.任何帮助是极大的赞赏.