草庐IT

database_connection

全部标签

database - 使用 typeORM 搜索早于日期的数据

我正在对PostgreDB执行查询以获取早于特定日期的数据。这是我的功能asyncfilesListToDelete():Promise{returnawaitthis.fileRepository.find({where:{last_modified:{$lt:'2018-11-1510:41:30.746877'}},});}这是我定义文件实体的方式:exportclassFile{@PrimaryGeneratedColumn()id:number;@Column({nullable:false})idFonc:number;@Column({nullable:false})ve

show dbs 和 show databases 之间的 MongoDB shell 区别

根据MongoDbdocumentationMongoDBshell命令:showdbsPrintalistofalldatabasesontheserver.和showdatabasesPrintalistofallavailabledatabases.我很困惑-从我阅读和理解的内容来看,这些不是相同的效果命令-对吗?showdatabases不是showdbs的别名吗?showdbs列出的数据库可能不可用且未被showdatabases列出,对吗?如果是这样,数据库在服务器上但不可用怎么可能-用户的访问权限?showdatabases过滤背后的原因是什么?

mongodb - 在 Docker 启动期间,我收到此消息 : "getting the final child' s pid from pipe caused "read init-p: connection reset by peer"

我在CentOSLinux7.6.1810和PleskOnyx17.8.11下安装了Docker,一切正常。几个小时以来,我无法再启动mongoDB或Docker。我收到此错误消息{"message":"OCIruntimecreatefailed:container_linux.go:344:startingcontainerprocesscaused\"process_linux.go:297:gettingthefinalchild'spidfrompipecaused\\\"readinit-复制代码p:连接由对等方重置\\\“\”:未知“它会是什么?

database - 使用聚合管道对新计算的数组字段进行排序和连接

我有一个用户集合和一个角色集合。用户has_many角色和角色存储为用户文档中的id数组。现在我想根据角色值对用户进行排序。用户可以具有一个或多个角色。如果用户有多个角色,那么我希望他们用逗号分隔:'admin'admin,marketing''user,marketing'这正是我想要按字母数字字符排序的数据,例如降序:'user,marketing''admin,marketing''admin'这是我试过的:db.users.aggregate([{$lookup:{from:'roles',localField:'role_ids',foreignField:'_id',as:

database - 确定数据结构

我是Mongo的新手。请帮助确定数据结构。我有分支,每个分支都有名称和屏幕数,每个分支都可以有很多播放列表,每个播放列表都有名称、开始日期、结束日期、总时间和文件。我需要告诉每个文件在哪个屏幕上应该以什么顺序显示,以及显示时间。我想在具有不同属性的不同播放列表中使用一个文件constFileSchema=Schema({url:{type:String,required:true},showTime:{type:Date,required:true},screen:{type:Number,required:true},order:{type:Number,required:true}

database-design - MongoDB 表方案设计-最佳实践。是否使用主文档(如在主表 rdbms 中)

背景:我在我的项目中使用MongoDB进行原型(prototype)设计,我使用一些主表来存储定义并在数据表中使用这些键。我的几个主表是ClassMaster_Feed_Provider{intkey;stringfeed_provider_namestringaddress}ClassMaster_File_Types{intid;stringtype}我的数据表是ClassData_Feeds{intid,intfile_type_key,intfeed_provider_key,DateTimetime}**我在这里使用feed_provider_key链接来自master_fe

python - Flask-PyMongo : how come "self._Collection__database"?

在Flask-PyMongo中,他们使用self._Collection__database来表示这个Collection对象所属的数据库对象:classCollection(collection.Collection):"""Customsub-classof:class:`pymongo.collection.Collection`whichaddsFlask-specifichelpermethods."""def__getattr__(self,name):attr=super(Collection,self).__getattr__(name)ifisinstance(att

mongodb - 运行mongodb --repair database is empty后

在我的开发机器上,我重新安装了ubuntu,并将文件从我的旧安装复制到/data/db。在看似正常的mongo--repair之后(没有错误消息等),我没有看到我期望看到的数据库。如何修复我的数据库?这里是日志文件的第一部分:ThuDec617:55:21[initandlisten]MongoDBstarting:pid=2123port=27017dbpath=/data/db/64-bithost=sogThuDec617:55:21[initandlisten]dbversionv2.2.2,pdfileversion4.5ThuDec617:55:21[initandlist

Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running

当docker ps出现CannotconnecttotheDockerdaemonatunix:///var/run/docker.sock.Isthedockerdaemonrunning以下报错时,首先systemctlstatusdocker查看docker服务的状态如果处于关闭状态则需要启动docker服务systemctlstartdocker如果服务是启动状态docker  ps还是报这个错vim/usr/lib/systemd/system/docker.service[Unit]Description=DockerApplicationContainerEngineDocum

node.js - 使用 connect-mongo 和 mongoose 在 mongodb 中存储 session

当我尝试使用mongodb配置express.jssession存储时,左右出现错误。我正在为我的框架使用机车并配置了Mongoose。在我的02_mongoose.js的初始化程序目录中,我有这个。module.exports=function(){mongoose.connect('mongodb://localhost:27018/basbac');mongoose.model('User',UserSchema);}我知道我已连接到数据库,因为我可以将我的用户拉入我的Controller。DeveloperController.show=function(){varself=t