草庐IT

bson_ext

全部标签

c# - MongoDb.Bson(官方)内部的AsXXX和ToXXX有什么区别

我只是想知道AsXXX和ToXXX操作在MongoDb中是如何工作的。比如我有如下操作varperson=newBsonDocument();person.Add("age",32);BsonValueage=person["age"];Console.WriteLine(age.AsBoolean);//throwsanexceptionConsole.WriteLine(age.ToBoolean());//TrueAsBoolean()抛出异常,具体为:System.InvalidCastException:Unabletocastobjectoftype'MongoDB.Bso

【Mac】mac 系统下格式化U盘或移动硬盘为ext4格式

1.打开终端,安装homebrew/bin/zsh-c"$(curl-fsSLhttps://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"2.安装之后再次运行此命令/bin/zsh-c"$(curl-fsSLhttps://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"3.安装e2fsprogsbrewinstalle2fsprogs4.查看所有硬盘分区diskutillist/dev/disk0(internal,physical):#:TYPENAMESIZEIDENTIF

node.js - 蒙哥错误: can't convert from BSON type missing to Date while Grouping records in nested documents

基本上我想根据月份对民意调查进行分组。我的模型:varmongoose=require('mongoose');varSchema=mongoose.Schema;varvoteSchema=newSchema({ip:String,votedOn:{type:Date,default:Date.now}});varchoiceSchema=newSchema({text:String,votes:[voteSchema]});varPollSchema=newSchema({question:{type:String,required:true},choices:[choiceSch

c# - 将 DBSet 集合作为 bson 文档插入到 Mongodb

我是EntityFramework核心的新手。我有一个包含所有DBSet对象的DBContext类。我想将所有对象序列化到MongoDB数据库。是否可以将DBSet对象写入mongodb而无需将它们转换为List对象。usingSystem;usingMicrosoft.EntityFrameworkCore;usingMicrosoft.EntityFrameworkCore.Metadata;namespaceZeiss.IMT.MCCNeo.DataMigration.Utilities{publicpartialclassmccdbContext:DbContext{publi

c# - MongoDB 在 InsertOne 上抛出 "MongoDB.Bson.BsonSerializationException"

我有以下模型:PublicclassUserInfo{publicstringId{get;}publicDictionaryMetadata{get;}}当我尝试向数据库添加一个新的UserInfo时:“http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name”作为我收藏的元数据中的键名,使用:Dbcontext.myCollection.InsertOne(data);我收到以下错误消息:MongoDB.Bson.BsonSerializationException:'Elementname'http://schemas.

ruby-on-rails - MongoId 和 bson_ext 问题 : no such file to load -- bson_ext

关于'bson_ext'有一个类似的问题,但它对我不起作用。MongoMapperandbson_extproblem我使用的是Rails2.3.8+MongoId1.9.1。我关注“installation”页面:geminstallmongoidgeminstallmongo-v=1.0.4geminstallbson_ext-v=1.0.4在我的config/environment.rb中,我添加了:config.gem'mongoid'config.gem'mongo',:version=>'1.0.4'config.gem'bson_ext',:verstion=>'1.0.

mongodb - MongoDB 中 cmd `show dbs` 的 BSON 文档(查询)是什么?

根据GettingStartedwithMongoDB,我们可以使用showdbs来获取现有数据库的列表。但这是一种在mongoshell中运行的命令。我的问题是如何为数据库列表编写一个mongodb查询(bson),这个查询应该发送到哪里? 最佳答案 这不是查询,但您可以对admin数据库运行listDatabases命令以获取BSON中的数据库列表:>useadminswitchedtodbadmin>db.runCommand({listDatabases:1}){"databases":[{"name":"local","s

mongodb 删除损坏的 BSON

在对我的数据库进行查询时,我得到了“$err”:“BSONElement:错误类型109”,“code”:10320为了识别文件,我用pymongo遍历了整个集合并得到了AssertionError:结果批处理从0开始,预期为205881我能够根据某些字段对我的收藏进行分组并按日期排序,这减少了搜索空间....我无法获得准确的文档,但至少可以在某个范围内找到它...不幸的是,尝试删除会引发:BSONObj大小:1597071153(0x315F315F)无效。大小必须在0到16793600(16MB)之间第一个元素:mall.jpg:?type=115知道如何解决这个问题...谢谢

mongodb - Elixir Bson 解码器在 utf8 > 16#FF 上失败

我正在阅读mongodb并使用Bson.decoder(data)。在此过程中,数据变成包含{"unitˊs",1}的元组列表。String.to_atom("unitˊs")显然失败了,因为第5个字符是带有的“MODIFIERLETTERACUTEACCENT(U+02CA)”**(ArgumentError)参数错误:erlang.binary_to_atom("unitˊs",:utf8)和http://erlang.org/doc/man/erlang.html#binary_to_atom-2笔记如果二进制包含大于16#FF的Unicode字符,binary_to_atom(

ruby - 使用 GridFS 时出现 "Document exceeds allowed max BSON size. The max is 16777216."错误

我正在尝试使用GridFS和ruby​​在我的mongo数据库中插入一个33MB的视频文件,并且我有一个系统的“文档超出允许的最大BSON大小。最大值为16777216。”。我认为在mongo集合中插入大于16MB的文件的唯一方法是使用Gridfs,所以我怀疑我做错了,即使我复制/粘贴了Ruby驱动程序示例(http://docs.mongodb.org/ecosystem/tutorial/ruby-driver-tutorial/#gridfs)。我正在使用Ruby2.2.1、mongo驱动程序2.0.4和mongodb3.0.1。我的代码:eDatabase=Mongo::Cli