我的搜索控制器中有两种方法
searchBoundingBox - 进行边界框搜索并需要边界框纬度和经度值。搜索 - 进行距离搜索(从中心点进行基于距离的搜索)。
我在路由文件中定义了我的两条路由,如下所示。
#Search
#bounding box
GET /search controllers.Search.searchBoundingBox(swLatitude:java.lang.String,swLongitude:java.lang.String, neLatitude:java.lang.String,neLongitude:java.lang.String)
# distance based
GET /search controllers.Search.search(latitude:java.lang.String,longitude:java.lang.String, offset:java.lang.Integer?=0,distance:java.lang.Integer?=50, limit:java.lang.Integer?=10)
Run Code Online (Sandbox Code Playgroud)
但是当我在第二条路线(基于距离)中创建查询时,它没有解决。
任何解决方法!!!(请注意,如果我更改路线的顺序,则边界框搜索失败)
我有1-用户和设备之间的关系(嵌入在用户架构中)
var UserSchema = new Schema({
devices: [DeviceSchema] //list of devices for the user
})
var DeviceSchema = new Schema({
deviceRegistrationId: String,
deviceOSType: String
});
Run Code Online (Sandbox Code Playgroud)
我有快速POST/api /设备中的Rest调用(标头中提供了用户ID)以将设备添加到用户集合中,我想仅在设备尚未存在于用户模型中时才添加设备.电话会议的主体就像是
{ deviceRegistrationId : "xx2233",
deviceOSType: "Android"
}
Run Code Online (Sandbox Code Playgroud)
我检查标头中的用户标识是否存在于用户集合中,如果存在,则仅在设备尚未存在于数据库中时才添加设备.
我目前的实现如下.
var userId = req.header('UserId');
var deviceRegistrationId = req.body.deviceRegistrationId;
User.findById({_id: userId}, function(err, user) {
if (user && user!==undefined) {
if (UserController.containsDevice(user.devices, deviceRegistrationId)) {
console.log('contains device - do nothing ');
res.send({errors: [{code: 666, message: 'Device Already Registered'}]})
} else {
user.devices.addToSet(req.body);
user.save();
//todo check what to …Run Code Online (Sandbox Code Playgroud) 我有两个类,事件和用户,有很多关系.
public class Event {
private int id;
private List<Users> users;
}
public class User {
private int id;
private List<Event> events;
}
Run Code Online (Sandbox Code Playgroud)
我已经读过@JsonIdentityInfo注释应该有帮助,但我看不到这个例子.
我在我的应用程序中加载Facebook个人资料图像时遇到问题.我从图表API获取了我的朋友列表,然后显示相关的朋友信息及其公开个人资料图片
我的HTML如下.
<div id = "profile_picture" style="float:left; width:100px;height: 100px" >
<img src="https://graph.facebook.com/{{providerUserId}}/picture?width=100&height=100"/>
</div>
<div id="user_basic_info" style="float:left;margin-left:14px;">
<div id="name" style="font-size:16px;font-weight:bold;margin-bottom:6px;">{{name}}</div>
<div id="email" style="margin-bottom:6px;width:400px;">{{email}}</div>
<div id="address"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
{{}}是通过模型填充的Mustache模板.出于某种原因,图像不会在Chrome中加载; 但在Chrome Canary,Firefox,Safari中运行良好.
如果我也传入硬编码的userId也没有区别.
任何指导?