- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我使用的是 MongoDB 版本 2.6。
我里面有大约 300 万条数据。 当我触发下面的查询时,它会挂起我的整个 Java 应用程序。
(我正在使用 Mongodb 连接器
从那里检索数据。)
db.collection_name.find{
"client_id.event.currentDate": {
$gte: "2016-12-18",
$lte: "2017-01-17"
},
"client_id.event.name": "SEARCH HOTELS SUCCESS",
_id: {
$lt: ObjectId('5856428ce4b0f530cc74c090')
}
}
检索此类大数据的最佳方法是什么?
编辑1:
我们对我的 Collection 有一个索引
{"client_id.event.name" : 1 ,"_id" :1 ,"client_id.event.currentDate" :1}
编辑2:
数据库中的示例文档:
{
"_id" : ObjectId("57a316a60cf26576defb7837"),
"client_id" : {
"clientIp" : "50.23.117.45",
"event" : {
"installationId" : "us2zv39vti5v",
"action" : "END",
"client_us_lastCommunicatedAt" : "2016-08-01T10:23:38.502Z",
"duration" : 60,
"client_us_userUpdatedOn" : null,
"name" : "APPSESSION",
"appId" : 3,
"userName" : "us2zv39vti5v",
"currentDate" : "2016-08-01T10:24:38.502Z",
"superProperties" : {
"client_us_installAt" : "2016-08-01T10:23:38.502Z",
"client_us_cookieEnabled" : true,
"client_us_referrer" : "Self",
"client_us_screen_width" : 768,
"client_us_counter" : 1,
"client_us_screen_height" : 1360,
"client_us_brand" : "Google",
"client_us_browser_version" : "23.32.12.20",
"client_us_screen_dpi" : 96,
"client_us_os" : "Windows",
"client_us_screen_colourDepth" : 24,
"client_us_os_version" : "10",
"client_us_flashVersion" : "no check",
"client_us_lastCommunicatedAt" : "2016-08-01T10:23:38.502Z",
"browser" : "Chrome",
"client_us_screen_pixelDepth" : 0,
"client_us_referring_domain" : "Self",
"client_us_css_pixel" : 1,
"client_us_mobile" : false
},
"userProperties" : {
"duration" : 60,
"Country" : "IN"
},
"installProperties" : {
"email" : "us2zv39vti5v@gmail.com"
}
}
}
}
最佳答案
您有 300 万条数据,每条数据至少有 4 个 Date 字段。现在,当 spring-mongo-data 向 mongo 请求所有这些内容时,它必须将日期的 String 值(这是一种 json 字符串日期格式 = Java String )转换为 1200 万个日期的 java Date 对象。所以还需要一段时间。
关于java - Mongodb查询挂系统,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41671358/
我在从 python 调用共享 c 库时遇到问题。库加载正常,公开的 3 个函数之一是可调用的,并且按预期工作;但是,当向库中添加另一个函数时,我发现其他两个不起作用。发生的事情是 python 卡在
我在使用 ImageIcon().GetImage() 时遇到问题 奇怪的是,它有时可以工作并向我显示带有 map 的窗口,而有时却不能。它也可以在其他计算机上完美运行,但不能在我的计算机上运行! 我
我们有时会遇到一个问题,即我们在 IIS 中有许多具有以下状态的请求:RequestAcquireState。 我们正在使用 SqlSessionStateStore 来管理 session 。当我们
我有一个 MobileSubstrate 插件,可以挂接跳板(不在实际的 objective-c 代码中,而是在 plist 中)。它包含一个 UIWebView,它加载一个 NSURLRequest
我正在尝试使用 Django 1.7,并按照说明进行操作 here .不幸的是,该过程似乎因以下输出而挂起: [Watt] ~/Projects/proj/proj master > python p
我正在使用 HDP 2.3.0.0-2557,我正在尝试运行如下所示的配置单元查询: beeline> !connect jdbc:hive2://localhost:10000 Connecting
我正在尝试使用 mxnet 设置 AWS Greengrass,以便在 Raspberry Pi 上进行机器学习。 当从 https://docs.aws.amazon.com/greengrass/
我是一名优秀的程序员,十分优秀!