草庐IT

x-message-ttl

全部标签

c# - 如何为存储为数组 [ticks,offset] 的 DatetimeOffset 创建 MongoDB TTL 索引?

我正在尝试在包含具有DateTimeOffset的文档的集合上创建MongoDBTTL索引。但是日期作为一个刻度数组和偏移量[ticks,offset]保存。例如:TimeStamp:Array[0:636803424000000000,1:-360]我的模型如下所示:publicclassLog{....DateTimeOffset?TimeStamp{get;set;}}我正在使用MongoDb.Driverv2.7.2,我一直在尝试以这种方式创建索引....varindexKeysDefinition=Builders.IndexKeys.Descending(l=>l.Time

javascript - 无法使 mongoose 过期/ttl 工作

varmongoose=require('mongoose'),Cache,cache;mongoose.connect('mongodb://localhost:27017/test');Cache=mongoose.model('Cache',mongoose.Schema({value:{},createdAt:{type:Date,expires:3600}}));cache=newCache({createdAt:newDate(),value:{foo:'bar'}});cache.save(function(err,obj){console.log(err,obj);pr

ruby-on-rails - 尝试插入 Mongodb 时出现 "Message Contains No Documents"

我正在构建一个RubyonRails应用程序,它利用Mongoidgem通过Mongodb存储数据。我的问题来自这个rake任务:require'rubygems'require'nokogiri'require'open-uri'task:scrape=>:environmentdopage=Nokogiri::HTML(open('https://maps.google.com/maps/ms?ie=UTF8&hl=en&source=embed&dg=feature&authuser=0&msa=0&output=kml&msid=208523333872813891131.00

ruby-on-rails - TTL for mongoid in rails

如mongodb网站所述,我可以使用.ensureIndex({state:1},{expireAfterSeconds:10})使记录过期。但是如何从rails中实现呢?谢谢 最佳答案 假设您使用的是MongoDB2.2,Ruby驱动程序应该已经通过Collection的create_index()支持它和ensure_index()方法。索引选项直接传递给服务器。API文档中带下划线的符号在内部进行翻译以方便使用(例如:drop_dups设置:dropDups选项)。你应该能够做到:@collection.create_inde

解决selenium.common.exceptions.WebDriverException:Message:‘msedgedriver‘executable needs to be in PATH

解决seleniumwebdriver模块的网页加载问题问题描述原因分析解决方案参考问题描述当尝试测试运行selenium模块加载浏览器时fromseleniumimportwebdriverdriver=webdriver.Edge()driver.get("http://www.baidu.com/")出现了如下错误:原因分析该Exception明确指出需要将指定的driver(我这里是edgedriver)放到PATH中。对于driver下载链接如下:Chrome:http://chromedriver.storage.googleapis.com/index.htmlEdge:http

node.js - 在集合 : Session 上设置 TTL 索引时出错

我知道有很多关于这个问题的话题,但其中任何一个都解决了我的问题。我实际上正在尝试在Heroku上部署我的项目,这对我来说是新事物。我的项目是一个基于ExpressAPI的node.js连接到MongoDB数据库。当我使用我的数据库在本地启动它时(没有登录名/密码)我没有这个错误,但是当我将它连接到heroku数据库时我得到一个:Error:ErrorsettingTTLindexoncollection:Session我的包.json"dependencies":{"express":"3.0.6","mongodb":"1.3.19","mongoskin":"0.5.0","MD5

node.js - Mongoosastic - { [错误 : No Living connections] message: 'No Living connections' }

我尝试使用mongoosastic进行搜索,但我不断收到“NoLivingconnections”错误和映射问题这是代码varmongoose=require('mongoose');varmongoosastic=require('mongoosastic');varSchema=mongoose.Schema;varJobSchema=Schema({category:{type:Schema.Types.ObjectId,ref:'Category',es_indexed:true},title:{type:String,es_indexed:true},});JobSchema

c# - 如何让mongo TTL在c#中过期

Mongo不会使旧集合过期。我检查以确保我的索引是日期类型。varkeys=IndexKeys.Ascending("expiry");varoptions=IndexOptions.SetTimeToLive(TimeSpan.FromMinutes(1));collection.EnsureIndex(keys,options);this.ExpireDate=newBsonDateTime(DateTime.UtcNow.AddMinutes(5));varinsertResult=collection.Insert(this);如有任何提示,我们将不胜感激。[{"v":1,"k

python - Mongodb TTL 清理不起作用

我试图让Mongo删除具有TTL功能的文档,但没有成功。尝试了很多东西,但mongo似乎没有清理。我的索引:{"v":1,"key":{"date":1},"name":"date_1","ns":"history.history","expireAfterSeconds":60}文档中的日期值:"date":"2016-09-2911:08:46.461207",db.serverStatus().metrics.ttl的输出:{"deletedDocuments":NumberLong(0),"passes":NumberLong(29)}db.serverStatus()的时间输

python - MongoDB TTL 索引不会删除过期文档

我正在尝试创建一个名为ttl的集合,并使用TTL索引使该集合中的文档在30秒后过期。我使用mongoengine创建了集合,像这样:classTtl(Document):meta={'indexes':[{'name':'TTL_index','fields':['expire_at'],'expireAfterSeconds':0}]}expire_at=DateTimeField()索引已创建,Robo3T显示它符合预期。实际文档也使用mongoengine插入到集合中:current_ttl=models.monkey.Ttl(expire_at=datetime.now()+t