草庐IT

indexed_document

全部标签

MongoDB 重命名收集失败,返回 "exceeds maximum length of 32, allowing for index names"

我们在重命名MongoDB中的集合时遇到问题。该集合有一些相当长的索引名称,但这在集合的一般使用中不是问题。我们可以写入并查询它,索引是有效的(如果索引不存在,我们可以通过查询性能的下降来判断)。然而,当我们重命名集合时,它会失败并显示以下消息:MongoDB.Driver.MongoCommandException:Command'renameCollection'failed:exception:collectionnamelengthof43exceedsmaximumlengthof32,allowingforindexnames(response:{"errmsg":"exc

c# - MongoDB C# 驱动程序 : How do I ensure an index using LINQ expressions on the contents of an array?

如何使用MongoDBC#驱动程序确保对数组内容使用LINQ表达式的索引?我目前有一个大致如下所示的领域对象:publicclassTeam{publicTeam(){Members=newList();}publicMongoDB.Bson.ObjectIdId{get;set;}publicstringDisplayName{get;set;}publicLazyReferenceLeader{get;set;}publicListMembers{get;privateset;}}publicclassLazyReference{publicMongoDB.Bson.ObjectI

php - Symfony2 和 MongoDB : FormType of a document with references

我的其中一份表格有问题。我有一个链接到其他3个文档的“资源”文档:标签(引用很多)类别(ReferenceOne)数据存储库(ReferenceOne)这是我的文档的定义:classResource{/***@MongoDB\Id*/private$id;/***@MongoDB\String*/private$name;/***@MongoDB\String*/private$description;/***@MongoDB\ReferenceMany(targetDocument="Tag")*/protected$tags;/***@MongoDB\ReferenceOne(ta

node.js - 类型 'x' 上不存在 Mongoose 属性 'Document'

ts编译器说“文档”类型上不存在任何属性。似乎正因为如此,模型上的所有属性都无法设置。如果我将用户对象打印到控制台,我得到的只是{"_id":"长十六进制ID号"}我的模型配置如下:用户.tsimport*asmongoosefrom'mongoose';import*ascryptofrom'crypto';import*asjwtfrom'jsonwebtoken';varuserSchema=newmongoose.Schema({email:{type:String,unique:true,required:true},firstMidname:{type:String,req

c# - 如何将嵌套的 Document 反序列化为特定的类对象?

我是MongoDb的新手,我正在尝试将嵌套在父文档中的文档数组序列化为特定的类对象。我的文档对象如下所示:Project{"_id":ObjectId("589da20997b2ae4608c99173"),//...additionalfields"Products":[{"_id":ObjectId("56971340f3a4990d2c199853"),"ProductId":null,"Name":null,"Description":null,//...quiteafewmoreproperties"Properties":null}],"CreatorUserId":LUU

c# - MongoDb C# 驱动程序解析命令插入失败 : document does not contain shard key

我正在为CosmosDB试验MongoDBApi,在数据库中插入值时出现以下错误:Commandinsertfailed:documentdoesnotcontainshardkey.我正在使用cosmosdb模拟器,我的分区键是“Id”这是我试过的一个简单的插入:mongoCollection.InsertOne(new{Name="John",Id=007});为了解决这个问题,我搜索并看到了这个问题:Similartomine,我尝试运行问题答案中指定的命令,如下所示:varcommand=newBsonDocument("{shardCollection:\"Mydb.coll

mongodb - Spring 启动 : Get an object from MongoDB document?

我正在使用SpringBoot2.1.3.RELEASE和MongoDB。我正在寻找一种方法来检索文档的一部分。存储库:@RepositorypublicinterfaceCompanyRepositoryextendsMongoRepository{}对象:@Data@DocumentpublicclassCompany{publicGeneralInfoinfo;publicMap>officeIdEmployeeMap;@DatapublicclassGeneralInfo{@IdpublicStringcompanyId;publicStringname;}@Datapubli

html - node.js , mongodb, mongoose, html 如何插入数据(在 index.html 中)?

varmongoose=require('mongoose')Schema=mongoose.Schema;mongoose.connect('mongodb://localhost/mydatabase');//connectdatabase/****DefineUserSchema***/varUserSchema=newSchema({user_id:String,email:String,base_location:Number,user_type:String,number_of_event:Number});mongoose.model('User',UserSchema)

git clone 报错 fatal: early EOF fatal: fetch-pack: invalid index-pack output

remote:Enumeratingobjects:122,done.error:4794bytesofbodyarestillexpected|0bytes/sfetch-pack:unexpecteddisconnectwhilereadingsidebandpacketfatal:earlyEOFfatal:fetch-pack:invalidindex-packoutput此报错显示文件夹只有只读权限。解决方式:选中要git的文件—》右击选中属性–》取消“只读”选项。再gitclone一下就KO了

c# - mongodb : How do I create text index with C# driver?

对于mongodb,如何在C#中创建以下索引?db.reviews.ensureIndex({comments:"text"})我在http://api.mongodb.org/csharp/current/?topic=html/7e62224e-33ab-098b-4e07-797c45494a63.htm上没有看到IndexOptions的任何“文本”选项 最佳答案 您需要通过脚本或直接在MongoDB数据库上进行设置,因为C#驱动程序未公开文本索引创建功能,因为它仍处于“测试版”。不幸的是,您也不能轻易地覆盖行为......