Code Monkey home page Code Monkey logo

mars's Introduction

Mars

MongoDB ORM/ODM for Java.

致自己

造自己的轮子,让别人去说

Mars - Object Relational Mapping Framework for NoSql (ORM)

Mars - Object Document Mapping Framework for NoSql (ODM)

👉 https://whaleal.com/ 👈

github star


🌎English Documentation


📚简介

mars是一款 关系映射框架和我们经常接触的JPA ,反射技术息息相关,本项目主要针对非关系型数据库,NoSql 大类。其相关性能已经超越 spring-data ,可以完全取代。

mars与spring具有兼容性。本身亦可单独使用。

mars 目标是兼容大多数的非关系型数据库,使用一套的标准查询方式 ,即可查询多种数据库。减少使用上的学习成本。让开发者有更多的精力创造业务上的价值。

🎁mars名称的由来

mars 是 上海锦木信息技术有限公司**东方航空公司 合作研发的一款ODM/ORM框架
纪念**火星探测任务“天问一号”的火星车祝融号成功登陆火星的乌托邦平原【2021年5月15日】,故起名为 mars。

🍺mars如何改变我们的coding方式

mars的目标是使得非关系型数据库使用一套标准的方式,即可简单的实现业务逻辑,减少开发者的学习使用成本,彻底改变我们写代码的方式。

mars的存在就是为了减少框架的学习成本,避免网络上参差不齐的代码出现导致的bug,同时避免重复造轮子。

使用一套标准 兼容多种Nosql 。


🛠️包含组件

一个MongoDB java ORM/ODM 框架,同时提供以下组件:

模块 介绍
mars-core 核心包
mars-springboot 基于springboot 自动注入的插件

可以根据需求对每个模块单独引入,也可以通过引入mars-core方式引入所有模块。


📝文档


📦安装

🍊Maven

在项目的pom.xml的dependencies中加入以下内容:

<dependency>
    <groupId>com.whaleal.mars</groupId>
    <artifactId>mars-core</artifactId>
    <version>x.x.x</version>
</dependency>

🍐Gradle

implementation 'com.whaleal.mars:mars-core:x.x.x'

📥下载jar

点击以下链接,下载mars-core-X.X.X.jar即可:

🔔️注意 所有版本编译起始均为JDK8+

🚽编译安装

访问mars的github主页:https://github.com/whaleal/mars 下载整个项目源码(v1-main或v1-dev分支都可)然后进入mars项目目录执行:

mvn install 

然后就可以使用Maven引入了。


🏗️添砖加瓦

🎋分支说明

mars的源码分为两个分支,功能如下:

分支 作用
main 主分支,release版本使用的分支,与**库提交的jar一致,不接收任何pr或修改
v1-main 大版本主分支,不同大版本具有不同vxx-main, 用于合并v1-dev,观察特性,不接收任何pr或修改
v1-dev 开发分支,默认为下个版本的SNAPSHOT版本,接受修改或pr

🐞提供bug反馈或建议

提交问题反馈请说明正在使用的JDK版本呢、mars版本和相关依赖库版本。

🧬贡献代码的步骤及PR遵照的原则

详见wiki How2Contribute

⭐欢迎关注

如果你觉得本项目还不错,欢迎持续关注,在此表示感谢^_^。

whaleal

其他相关项目

Project

社区支持

本项目由 whaleal社区提供支持

What is Mars

Mars is a unified driver platform product developed by Shanghai Jinmu Information Technology Co., Ltd., which is based on Mongodb's driver layer framework and developed with Java language. It makes further innovation on the basis of the original driver function, making the operation more convenient and fast.

It uses similar query method as spring, and has higher performance than spring. In the preliminary comparative test, it is improved more than 25% than spring.

LICENSE

Mars is free and the source is available. All versions released after 2020, including patch fixes for prior versions, are published under the Server Side Public License (SSPL) v1. See individual files for details.

supporter

Jinmu Logo

If you have any problems or suggestions, welcome to contact us!

Hotline:021-58870038 / 021-66696778
Email:[email protected]
Office address: building 10, 1228 Jiangchang Rd, Jiangan District, Shanghai, P.R.C

mars's People

Contributors

a65858835 avatar chen5864 avatar hbnking avatar whalefalls0807 avatar zzbka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

mars's Issues

Exception when field contains a dot

java.lang.IllegalArgumentException: Invalid BSON field name a.dot
	at org.bson.AbstractBsonWriter.writeName(AbstractBsonWriter.java:531)
	at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:198)
	at org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:141)
	at org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:45)
	at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:63)
	at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:29)
	at com.mongodb.operation.BulkWriteBatch$WriteRequestEncoder.encode(BulkWriteBatch.java:381)
	at com.mongodb.operation.BulkWriteBatch$WriteRequestEncoder.encode(BulkWriteBatch.java:371)
	at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:63)
	at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:29)
	at com.mongodb.connection.BsonWriterHelper.writeDocument(BsonWriterHelper.java:74)
	at com.mongodb.connection.BsonWriterHelper.writePayload(BsonWriterHelper.java:58)
	at com.mongodb.connection.BsonWriterHelper.writePayloadArray(BsonWriterHelper.java:50)
	at com.mongodb.connection.SplittablePayloadBsonWriter.writeEndDocument(SplittablePayloadBsonWriter.java:52)
	at org.bson.codecs.BsonDocumentCodec.encode(BsonDocumentCodec.java:118)
	at org.bson.codecs.BsonDocumentCodec.encode(BsonDocumentCodec.java:41)
	at com.mongodb.connection.CommandMessage.addDocumentWithPayload(CommandMessage.java:166)
	at com.mongodb.connection.CommandMessage.encodeMessageBodyWithMetadata(CommandMessage.java:148)
	at com.mongodb.connection.RequestMessage.encode(RequestMessage.java:145)
	at com.mongodb.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:244)
	at com.mongodb.connection.UsageTrackingInternalConnection.sendAndReceive(UsageTrackingInternalConnection.java:98)
	at com.mongodb.connection.DefaultConnectionPool$PooledConnection.sendAndReceive(DefaultConnectionPool.java:441)
	at com.mongodb.connection.CommandProtocolImpl.execute(CommandProtocolImpl.java:76)
	at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:189)
	at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:263)
	at com.mongodb.connection.DefaultServerConnection.command(DefaultServerConnection.java:126)
	at com.mongodb.operation.MixedBulkWriteOperation.executeCommand(MixedBulkWriteOperation.java:373)
	at com.mongodb.operation.MixedBulkWriteOperation.executeBulkWriteBatch(MixedBulkWriteOperation.java:255)
	at com.mongodb.operation.MixedBulkWriteOperation.access$700(MixedBulkWriteOperation.java:66)
	at com.mongodb.operation.MixedBulkWriteOperation$1.call(MixedBulkWriteOperation.java:199)
	at com.mongodb.operation.MixedBulkWriteOperation$1.call(MixedBulkWriteOperation.java:190)
	at com.mongodb.operation.OperationHelper.withReleasableConnection(OperationHelper.java:432)
	at com.mongodb.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:190)
	at com.mongodb.operation.MixedBulkWriteOperation.execute(MixedBulkWriteOperation.java:66)
	at com.mongodb.Mongo$3.execute(Mongo.java:833)
	at com.mongodb.MongoCollectionImpl.executeInsertMany(MongoCollectionImpl.java:552)
	at com.mongodb.MongoCollectionImpl.insertMany(MongoCollectionImpl.java:524)
	at io.prestosql.plugin.mongodb.MongoPageSink.appendPage(MongoPageSink.java:115)
	at io.prestosql.operator.TableWriterOperator.addInput(TableWriterOperator.java:238)
	at io.prestosql.operator.Driver.processInternal(Driver.java:384)
	at io.prestosql.operator.Driver.lambda$processFor$8(Driver.java:283)
	at io.prestosql.operator.Driver.tryWithLock(Driver.java:675)
	at io.prestosql.operator.Driver.processFor(Driver.java:276)å

运行时异常处理时异常

java.lang.IllegalArgumentException: collectionName can't be nul when resultType is Entity
at com.whaleal.mars.session.AggregationImpl.execute(AggregationImpl.java:115)
at com.whaleal.mars.session.AggregationImpl.aggregate(AggregationImpl.java:88)
at com.whaleal.mars.session.AggregationImpl.aggregate(AggregationImpl.java:72)
at com.whaleal.mars.core.aggreation.MarsAggregationTest.testGroupCount(MarsAggregationTest.java:62)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

testAggPtoject(com.whaleal.mars.core.aggreation.MarsAggregationTest) Time elapsed: 0.018 sec <<< ERROR!
com.mongodb.MongoCommandException: Command failed with error 16406: 'The top-level _id field is the only field currently supported for exclusion' on server 192.168.3.134:37017. The full response is {"ok": 0.0, "errmsg": "The top-level _id field is the only field currently supported for exclusion", "code": 16406}
at com.mongodb.internal.connection.ProtocolHelper.getCommandFailureException(ProtocolHelper.java:198)
at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:418)
at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:342)
at com.mongodb.internal.connection.UsageTrackingInternalConnection.sendAndReceive(UsageTrackingInternalConnection.java:116)
at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.sendAndReceive(DefaultConnectionPool.java:647)
at com.mongodb.internal.connection.CommandProtocolImpl.execute(CommandProtocolImpl.java:71)
at com.mongodb.internal.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:244)
at com.mongodb.internal.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:227)
at com.mongodb.internal.connection.DefaultServerConnection.command(DefaultServerConnection.java:127)
at com.mongodb.internal.connection.DefaultServerConnection.command(DefaultServerConnection.java:117)
at com.mongodb.internal.connection.DefaultServer$OperationCountTrackingConnection.command(DefaultServer.java:348)
at com.mongodb.internal.operation.CommandOperationHelper.createReadCommandAndExecute(CommandOperationHelper.java:228)
at com.mongodb.internal.operation.CommandOperationHelper.lambda$executeRetryableRead$4(CommandOperationHelper.java:210)
at com.mongodb.internal.operation.OperationHelper.lambda$withSourceAndConnection$2(OperationHelper.java:564)
at com.mongodb.internal.operation.OperationHelper.withSuppliedResource(OperationHelper.java:589)
at com.mongodb.internal.operation.OperationHelper.lambda$withSourceAndConnection$3(OperationHelper.java:563)
at com.mongodb.internal.operation.OperationHelper.withSuppliedResource(OperationHelper.java:589)
at com.mongodb.internal.operation.OperationHelper.withSourceAndConnection(OperationHelper.java:562)
at com.mongodb.internal.operation.CommandOperationHelper.lambda$executeRetryableRead$5(CommandOperationHelper.java:207)
at com.mongodb.internal.async.function.RetryingSyncSupplier.get(RetryingSyncSupplier.java:65)
at com.mongodb.internal.operation.CommandOperationHelper.executeRetryableRead(CommandOperationHelper.java:213)
at com.mongodb.internal.operation.CommandOperationHelper.executeRetryableRead(CommandOperationHelper.java:193)
at com.mongodb.internal.operation.AggregateOperationImpl.execute(AggregateOperationImpl.java:195)
at com.mongodb.internal.operation.AggregateOperation.execute(AggregateOperation.java:306)
at com.mongodb.internal.operation.AggregateOperation.execute(AggregateOperation.java:46)
at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:191)
at com.mongodb.client.internal.MongoIterableImpl.execute(MongoIterableImpl.java:135)
at com.mongodb.client.internal.MongoIterableImpl.iterator(MongoIterableImpl.java:92)
at com.whaleal.mars.session.AggregationImpl.execute(AggregationImpl.java:130)
at com.whaleal.mars.session.AggregationImpl.aggregate(AggregationImpl.java:88)
at com.whaleal.mars.session.AggregationImpl.aggregate(AggregationImpl.java:72)
at com.whaleal.mars.core.aggreation.MarsAggregationTest.testAggPtoject(MarsAggregationTest.java:49)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Running com.whaleal.mars.core.TestMongoBsonOBject

TooManyLogicalSessions Error

在一百个线程,使用Mars插入数据时,出现以下错误:
Cormand failed with error 261 (TooManyLogicalSessions): "Unable to add session ID c85b87ec-d97e-42c3-b819-d7859acc5b7d - Y5nrDaxi8gy8RndTsQ+1j7fnkr7JUsabhNnXAheU0fg- into the cache because the number of a
ctive sessions is too high" on server 172.233.72.34:27001. The full response is f"ok": 0.0, "errmsg": "Uhable to add session ID c85b87ec-d97e-42c3-b819-d7859acc5b7d - Y5mrDaxi8gv8RndTsQ+1j7fnkr7JUsabhNnXA
heUOfg= into the cache because the number of active sessions is too high", "code": 261, "codeName": "TooManyLogicalSessions"
com.mongodb.MongoConmandException: Command failed with error 261 (TooManylogicalSessions): "Unable to add session ID 32b60b4b-f3f3-42fa-b657-cbb6b8d2fd80 - Y5mrDaxi8gy8RndTsQ+1j7fnkr7JUsabhNnXAheU0fg- int
o the cache because the number of active sessions is too high" on server 172.233.72.34:27001. The full response is f"ok": 0.0, "errmsg": "Unable to add session ID 32b60b4b-f3f3-42fa-b657-cbb6b8d2fd80 - Y5
mrDaxi8gv8RndTsQ+1j7fmkr7JUsabhNmXAheUOfg- into the cache because the number of active sessions is too high", "code": 261, "codeName": "TooManyLogicalSessions"
at com.mongodb.internal.connection.ProtocolHelper.getCommandFailureException(ProtocolHelper.java:175)

聚合操作的 $dateToParts 不可用

执行的聚合语句:
pipeline.project(Projection.of().include("date", DateExpressions.dateToParts(field("date")))
.include("date_iso",DateExpressions.dateToParts(new DocumentExpression().field("date",field("date")).field("iso8601",value("true"))))
.include("date_timezone",DateExpressions.dateToParts(new DocumentExpression().field("date",field("date")).field("timezone",value("America/New_York")))));

报错信息:
java.lang.IllegalStateException: notInValidState($dateToParts, name) writer: {$project: {date: <<|>>

at com.whaleal.mars.codecs.writer.WriteState.name(WriteState.java:98)
at com.whaleal.mars.codecs.writer.DocumentWriter.writeStartDocument(DocumentWriter.java:296)
at com.whaleal.mars.core.aggregation.codecs.ExpressionHelper.document(ExpressionHelper.java:66)
at com.whaleal.mars.core.aggregation.expressions.impls.DateToParts.encode(DateToParts.java:59)
at com.whaleal.mars.core.aggregation.codecs.ExpressionCodec.encode(ExpressionCodec.java:57)
at com.whaleal.mars.core.aggregation.codecs.ExpressionCodec.encode(ExpressionCodec.java:42)
at org.bson.codecs.EncoderContext.encodeWithChildContext(EncoderContext.java:91)
at com.whaleal.mars.core.aggregation.codecs.ExpressionHelper.value(ExpressionHelper.java:101)
at com.whaleal.mars.core.aggregation.codecs.stages.ProjectionCodec.lambda$encodeStage$0(ProjectionCodec.java:54)
at com.whaleal.mars.core.aggregation.codecs.ExpressionHelper.document(ExpressionHelper.java:61)
at com.whaleal.mars.core.aggregation.codecs.stages.ProjectionCodec.encodeStage(ProjectionCodec.java:52)
at com.whaleal.mars.core.aggregation.codecs.stages.ProjectionCodec.encodeStage(ProjectionCodec.java:39)
at com.whaleal.mars.core.aggregation.codecs.stages.StageCodec.lambda$encode$0(StageCodec.java:59)
at com.whaleal.mars.core.aggregation.codecs.ExpressionHelper.document(ExpressionHelper.java:61)
at com.whaleal.mars.core.aggregation.codecs.stages.StageCodec.encode(StageCodec.java:57)
at com.whaleal.mars.core.aggregation.codecs.stages.StageCodec.encode(StageCodec.java:42)
at com.whaleal.mars.session.AggregationImpl.lambda$getDocuments$0(AggregationImpl.java:148)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at com.whaleal.mars.session.AggregationImpl.getDocuments(AggregationImpl.java:151)
at com.whaleal.mars.session.AggregationImpl.execute(AggregationImpl.java:134)
at com.whaleal.mars.session.AggregationImpl.aggregate(AggregationImpl.java:100)
at com.whaleal.mars.session.AggregationImpl.aggregate(AggregationImpl.java:91)
at com.whaleal.mars.core.aggreation.DateToPartsTest.testFor(DateToPartsTest.java:69)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)

0.9.7. 事务异常

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-11-30 07:39:31.385 -org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter.report(LoggingFailureAnalysisReporter.java:40) [ main] LoggingFailureAnalysisReporter :


APPLICATION FAILED TO START


Description:

Parameter 0 of method mongoTransactionManager in com.whaleal.mars.config.MarsAutoConfiguration required a bean of type 'com.whaleal.mars.codecs.MongoMappingContext' that could not be found.

Action:

Consider defining a bean of type 'com.whaleal.mars.codecs.MongoMappingContext' in your configuration.

Process finished with exit code 1

add 实体类的加密

读取实体类数据解密
保存实体类数据解密

可以用户自定义加密算法
例如常见的对称加密算法包括AES、DES、3DES,非对称加密算法包括RSA、DSA、ECC

MarsAggregationTest

运行聚合测试时异常
12:55:15.837 [main] DEBUG org.mongodb.driver.protocol.command - Sending command '{"aggregate": "person", "pipeline": [{"$project": {"age": false}}], "cursor": {}}' with request id 264 to database admin on connection [connectionId{localValue:128, serverValue:8746}] to server 192.168.3.134:37017
12:55:15.858 [main] DEBUG org.mongodb.driver.protocol.command - Execution of command with request id 264 failed to complete successfully in 27.91 ms on connection [connectionId{localValue:128, serverValue:8746}] to server 192.168.3.134:37017
com.mongodb.MongoCommandException: Command failed with error 16406: 'The top-level _id field is the only field currently supported for exclusion' on server 192.168.3.134:37017. The full response is {"ok": 0.0, "errmsg": "The top-level _id field is the only field currently supported for exclusion", "code": 16406}
at com.mongodb.internal.connection.ProtocolHelper.getCommandFailureException(ProtocolHelper.java:198)
at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:418)
at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:342)
at com.mongodb.internal.connection.UsageTrackingInternalConnection.sendAndReceive(UsageTrackingInternalConnection.java:116)
at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.sendAndReceive(DefaultConnectionPool.java:647)
at com.mongodb.internal.connection.CommandProtocolImpl.execute(CommandProtocolImpl.java:71)
at com.mongodb.internal.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:244)
at com.mongodb.internal.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:227)
at com.mongodb.internal.connection.DefaultServerConnection.command(DefaultServerConnection.java:127)
at com.mongodb.internal.connection.DefaultServerConnection.command(DefaultServerConnection.java:117)
at com.mongodb.internal.connection.DefaultServer$OperationCountTrackingConnection.command(DefaultServer.java:348)
at com.mongodb.internal.operation.CommandOperationHelper.createReadCommandAndExecute(CommandOperationHelper.java:228)
at com.mongodb.internal.operation.CommandOperationHelper.lambda$executeRetryableRead$4(CommandOperationHelper.java:210)
at com.mongodb.internal.operation.OperationHelper.lambda$withSourceAndConnection$2(OperationHelper.java:564)
at com.mongodb.internal.operation.OperationHelper.withSuppliedResource(OperationHelper.java:589)
at com.mongodb.internal.operation.OperationHelper.lambda$withSourceAndConnection$3(OperationHelper.java:563)
at com.mongodb.internal.operation.OperationHelper.withSuppliedResource(OperationHelper.java:589)
at com.mongodb.internal.operation.OperationHelper.withSourceAndConnection(OperationHelper.java:562)
at com.mongodb.internal.operation.CommandOperationHelper.lambda$executeRetryableRead$5(CommandOperationHelper.java:207)
at com.mongodb.internal.async.function.RetryingSyncSupplier.get(RetryingSyncSupplier.java:65)
at com.mongodb.internal.operation.CommandOperationHelper.executeRetryableRead(CommandOperationHelper.java:213)
at com.mongodb.internal.operation.CommandOperationHelper.executeRetryableRead(CommandOperationHelper.java:193)
at com.mongodb.internal.operation.AggregateOperationImpl.execute(AggregateOperationImpl.java:195)
at com.mongodb.internal.operation.AggregateOperation.execute(AggregateOperation.java:306)
at com.mongodb.internal.operation.AggregateOperation.execute(AggregateOperation.java:46)
at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:191)
at com.mongodb.client.internal.MongoIterableImpl.execute(MongoIterableImpl.java:135)
at com.mongodb.client.internal.MongoIterableImpl.iterator(MongoIterableImpl.java:92)
at com.whaleal.mars.session.AggregationImpl.execute(AggregationImpl.java:130)
at com.whaleal.mars.session.AggregationImpl.aggregate(AggregationImpl.java:88)
at com.whaleal.mars.session.AggregationImpl.aggregate(AggregationImpl.java:72)
at com.whaleal.mars.core.aggreation.AggreationCodecTest.testAggPtoject(AggreationCodecTest.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
12:55:15.860 [main] DEBUG org.mongodb.driver.operation - Unable to retry the operation aggregate due to the error "com.mongodb.MongoCommandException: Command failed with error 16406: 'The top-level _id field is the only field currently supported for exclusion' on server 192.168.3.134:37017. The full response is {"ok": 0.0, "errmsg": "The top-level _id field is the only field currently supported for exclusion", "code": 16406}"
Tests run: 3, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 1.314 sec <<< FAILURE!
testGroupCount(com.whaleal.mars.core.aggreation.AggreationCodecTest) Time elapsed: 0.035 sec <<< ERROR!
java.lang.IllegalArgumentException: collectionName can't be nul when resultType is Entity
at com.whaleal.mars.session.AggregationImpl.execute(AggregationImpl.java:115)
at com.whaleal.mars.session.AggregationImpl.aggregate(AggregationImpl.java:88)
at com.whaleal.mars.session.AggregationImpl.aggregate(AggregationImpl.java:72)
at com.whaleal.mars.core.aggreation.AggreationCodecTest.testGroupCount(AggreationCodecTest.java:78)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

testAggPtoject(com.whaleal.mars.core.aggreation.AggreationCodecTest) Time elapsed: 0.35 sec <<< ERROR!
com.mongodb.MongoCommandException: Command failed with error 16406: 'The top-level _id field is the only field currently supported for exclusion' on server 192.168.3.134:37017. The full response is {"ok": 0.0, "errmsg": "The top-level _id field is the only field currently supported for exclusion", "code": 16406}
at com.mongodb.internal.connection.ProtocolHelper.getCommandFailureException(ProtocolHelper.java:198)
at com.mongodb.internal.connection.InternalStreamConnection.receiveCommandMessageResponse(InternalStreamConnection.java:418)
at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:342)
at com.mongodb.internal.connection.UsageTrackingInternalConnection.sendAndReceive(UsageTrackingInternalConnection.java:116)
at com.mongodb.internal.connection.DefaultConnectionPool$PooledConnection.sendAndReceive(DefaultConnectionPool.java:647)
at com.mongodb.internal.connection.CommandProtocolImpl.execute(CommandProtocolImpl.java:71)
at com.mongodb.internal.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:244)
at com.mongodb.internal.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:227)
at com.mongodb.internal.connection.DefaultServerConnection.command(DefaultServerConnection.java:127)
at com.mongodb.internal.connection.DefaultServerConnection.command(DefaultServerConnection.java:117)
at com.mongodb.internal.connection.DefaultServer$OperationCountTrackingConnection.command(DefaultServer.java:348)
at com.mongodb.internal.operation.CommandOperationHelper.createReadCommandAndExecute(CommandOperationHelper.java:228)
at com.mongodb.internal.operation.CommandOperationHelper.lambda$executeRetryableRead$4(CommandOperationHelper.java:210)
at com.mongodb.internal.operation.OperationHelper.lambda$withSourceAndConnection$2(OperationHelper.java:564)
at com.mongodb.internal.operation.OperationHelper.withSuppliedResource(OperationHelper.java:589)
at com.mongodb.internal.operation.OperationHelper.lambda$withSourceAndConnection$3(OperationHelper.java:563)
at com.mongodb.internal.operation.OperationHelper.withSuppliedResource(OperationHelper.java:589)
at com.mongodb.internal.operation.OperationHelper.withSourceAndConnection(OperationHelper.java:562)
at com.mongodb.internal.operation.CommandOperationHelper.lambda$executeRetryableRead$5(CommandOperationHelper.java:207)
at com.mongodb.internal.async.function.RetryingSyncSupplier.get(RetryingSyncSupplier.java:65)
at com.mongodb.internal.operation.CommandOperationHelper.executeRetryableRead(CommandOperationHelper.java:213)
at com.mongodb.internal.operation.CommandOperationHelper.executeRetryableRead(CommandOperationHelper.java:193)
at com.mongodb.internal.operation.AggregateOperationImpl.execute(AggregateOperationImpl.java:195)
at com.mongodb.internal.operation.AggregateOperation.execute(AggregateOperation.java:306)
at com.mongodb.internal.operation.AggregateOperation.execute(AggregateOperation.java:46)
at com.mongodb.client.internal.MongoClientDelegate$DelegateOperationExecutor.execute(MongoClientDelegate.java:191)
at com.mongodb.client.internal.MongoIterableImpl.execute(MongoIterableImpl.java:135)
at com.mongodb.client.internal.MongoIterableImpl.iterator(MongoIterableImpl.java:92)
at com.whaleal.mars.session.AggregationImpl.execute(AggregationImpl.java:130)
at com.whaleal.mars.session.AggregationImpl.aggregate(AggregationImpl.java:88)
at com.whaleal.mars.session.AggregationImpl.aggregate(AggregationImpl.java:72)
at com.whaleal.mars.core.aggreation.AggreationCodecTest.testAggPtoject(AggreationCodecTest.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Running com.whaleal.mars.core.aggreation.MarsAggregationTest

insertMany 操作时异常 E11000 duplicate key error collection

insertMany(com.whaleal.mars.core.crud.CrudTest) Time elapsed: 0.008 sec <<< ERROR!
com.mongodb.MongoWriteException: Write operation error on server 192.168.3.134:37017. Write error: WriteError{code=11000, message='E11000 duplicate key error collection: admin.stu index: id dup key: { : "10000" }', details={}}.
at com.mongodb.client.internal.MongoCollectionImpl.executeSingleWriteRequest(MongoCollectionImpl.java:1018)
at com.mongodb.client.internal.MongoCollectionImpl.executeInsertOne(MongoCollectionImpl.java:471)
at com.mongodb.client.internal.MongoCollectionImpl.insertOne(MongoCollectionImpl.java:454)
at com.whaleal.mars.session.executor.InsertOneExecutor.execute(InsertOneExecutor.java:76)
at com.whaleal.mars.session.DatastoreImpl.insert(DatastoreImpl.java:202)
at com.whaleal.mars.session.Datastore.insert(Datastore.java:163)
at com.whaleal.mars.session.Datastore.insert(Datastore.java:149)
at com.whaleal.mars.core.crud.CrudTest.insertMany(CrudTest.java:95)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:84)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Running com.whaleal.mars.core.index.IndexTest

使用update的addToSet时栈溢出

java.lang.StackOverflowError
at com.whaleal.icefrog.core.collection.ArrayIter.(ArrayIter.java:68)
at com.whaleal.icefrog.core.collection.ArrayIter.(ArrayIter.java:56)
at com.whaleal.icefrog.core.collection.ArrayIter.(ArrayIter.java:45)
at com.whaleal.icefrog.core.collection.ArrayIter.(ArrayIter.java:19)
at com.whaleal.icefrog.core.collection.ArrayIter.(ArrayIter.java:68)
at com.whaleal.icefrog.core.collection.ArrayIter.(ArrayIter.java:56)
at com.whaleal.icefrog.core.collection.ArrayIter.(ArrayIter.java:45)
at com.whaleal.icefrog.core.collection.ArrayIter.(ArrayIter.java:19)
at com.whaleal.icefrog.core.collection.ArrayIter.(ArrayIter.java:68)
at com.whaleal.icefrog.core.collection.ArrayIter.(ArrayIter.java:56)
at com.whaleal.icefrog.core.collection.ArrayIter.(ArrayIter.java:45)
at com.whaleal.icefrog.core.collection.ArrayIter.(ArrayIter.java:19)
at com.whaleal.icefrog.core.collection.ArrayIter.(ArrayIter.java:68)
at com.whaleal.icefrog.core.collection.ArrayIter.(ArrayIter.java:56)
at com.whaleal.icefrog.core.collection.ArrayIter.(ArrayIter.java:45)

SessionCommand--endSession测试问题

测试需要传入UUID才能执行命令,传入后报出以下错误:
org.bson.codecs.configuration.CodecConfigurationException: The uuidRepresentation has not been specified, so the UUID cannot be encoded
尝试以二进制的形式传入,传入后报出以下错误:
com.mongodb.MongoCommandException: Command failed with error 14 (TypeMismatch): 'BSON field 'endSessions.endSessionsFromClient.id' is the wrong bindData type 'general', expected type 'UUID''

push. each 时解析 数组元素时异常

Document{{$push=Document{{logList={"$each":{}}}}}}

org.bson.codecs.configuration.CodecConfigurationException: Unable to get value for property 'key' in Each

at com.whaleal.mars.codecs.pojo.PropertyAccessorImpl.getError(PropertyAccessorImpl.java:85)
at com.whaleal.mars.codecs.pojo.PropertyAccessorImpl.get(PropertyAccessorImpl.java:61)
at com.whaleal.mars.codecs.pojo.EntityEncoder.encodeProperty(EntityEncoder.java:121)
at com.whaleal.mars.codecs.pojo.EntityEncoder.lambda$encodeEntity$0(EntityEncoder.java:83)
at com.whaleal.mars.core.aggregation.codecs.ExpressionHelper.document(ExpressionHelper.java:61)
at com.whaleal.mars.codecs.pojo.EntityEncoder.encodeEntity(EntityEncoder.java:68)
at com.whaleal.mars.codecs.pojo.EntityEncoder.encode(EntityEncoder.java:56)
at com.whaleal.mars.codecs.pojo.MarsCodec.encode(MarsCodec.java:128)
at com.whaleal.mars.codecs.pojo.EntityEncoder.encodeEntity(EntityEncoder.java:89)
at com.whaleal.mars.codecs.pojo.EntityEncoder.encode(EntityEncoder.java:56)
at com.whaleal.mars.codecs.pojo.MarsCodec.encode(MarsCodec.java:128)
at com.whaleal.mars.codecs.pojo.CollectionCodec.encode(CollectionCodec.java:67)
at com.whaleal.mars.codecs.pojo.CollectionCodec.encode(CollectionCodec.java:47)
at org.bson.codecs.EncoderContext.encodeWithChildContext(EncoderContext.java:91)
at com.whaleal.mars.codecs.pojo.EntityEncoder.encodeValue(EntityEncoder.java:133)
at com.whaleal.mars.codecs.pojo.EntityEncoder.encodeProperty(EntityEncoder.java:122)
at com.whaleal.mars.codecs.pojo.EntityEncoder.lambda$encodeEntity$0(EntityEncoder.java:83)
at com.whaleal.mars.core.aggregation.codecs.ExpressionHelper.document(ExpressionHelper.java:61)
at com.whaleal.mars.codecs.pojo.EntityEncoder.encodeEntity(EntityEncoder.java:68)
at com.whaleal.mars.codecs.pojo.EntityEncoder.encode(EntityEncoder.java:56)
at com.whaleal.mars.codecs.pojo.MarsCodec.encode(MarsCodec.java:128)
at org.bson.codecs.EncoderContext.encodeWithChildContext(EncoderContext.java:91)
at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:203)
at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:217)
at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:200)
at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:217)
at org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:159)
at org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:46)
at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:63)
at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:29)
at com.mongodb.internal.connection.SplittablePayload$WriteRequestEncoder.encode(SplittablePayload.java:221)
at com.mongodb.internal.connection.SplittablePayload$WriteRequestEncoder.encode(SplittablePayload.java:187)
at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:63)
at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:29)
at com.mongodb.internal.connection.BsonWriterHelper.writeDocument(BsonWriterHelper.java:77)
at com.mongodb.internal.connection.BsonWriterHelper.writePayload(BsonWriterHelper.java:59)
at com.mongodb.internal.connection.BsonWriterHelper.writePayloadArray(BsonWriterHelper.java:50)
at com.mongodb.internal.connection.SplittablePayloadBsonWriter.writeEndDocument(SplittablePayloadBsonWriter.java:64)
at org.bson.codecs.BsonDocumentCodec.encode(BsonDocumentCodec.java:121)
at org.bson.codecs.BsonDocumentCodec.encode(BsonDocumentCodec.java:42)
at com.mongodb.internal.connection.CommandMessage.addDocumentWithPayload(CommandMessage.java:198)
at com.mongodb.internal.connection.CommandMessage.encodeMessageBodyWithMetadata(CommandMessage.java:182)
at com.mongodb.internal.connection.RequestMessage.encode(RequestMessage.java:138)
at com.mongodb.internal.connection.CommandMessage.encode(CommandMessage.java:59)
at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:268)
at com.mongodb.internal.connection.UsageTrackingInternalConnection.sendAndReceive(UsageTrackingInternalConnection.java:100)

Unable to get value for property xxxx

Unable to get value for property 'mongoMemberInfoList' in MongoClusterInformation
org.bson.codecs.configuration.CodecConfigurationException: Unable to get value for property 'mongoMemberInfoList' in MongoClusterInformation
 at com.whaleal.mars.codecs.pojo.PropertyAccessorImpl.getError(PropertyAccessorImpl.java:85)
 at com.whaleal.mars.codecs.pojo.PropertyAccessorImpl.get(PropertyAccessorImpl.java:61)
 at com.whaleal.mars.codecs.pojo.EntityEncoder.encodeProperty(EntityEncoder.java:121)
 at com.whaleal.mars.codecs.pojo.EntityEncoder.lambda$encodeEntity$0(EntityEncoder.java:83)
 at com.whaleal.mars.core.aggregation.codecs.ExpressionHelper.document(ExpressionHelper.java:50)
 at com.whaleal.mars.codecs.pojo.EntityEncoder.encodeEntity(EntityEncoder.java:68)
 at com.whaleal.mars.codecs.pojo.EntityEncoder.encode(EntityEncoder.java:56)
 at com.whaleal.mars.codecs.pojo.MarsCodec.encode(MarsCodec.java:128)
 at com.whaleal.mars.session.DatastoreImpl.toDocument(DatastoreImpl.java:774)
 at com.whaleal.mars.session.DatastoreImpl.save(DatastoreImpl.java:656)
 at com.whaleal.mars.session.Datastore.save(Datastore.java:311)
 at com.whaleal.ops.web.api.service.impl.MongoDbDataServiceImpl.updateClusterInfo(MongoDbDataServiceImpl.java:1277)
 at com.whaleal.ops.web.api.service.impl.MongoDbDataServiceImpl$$FastClassBySpringCGLIB$$fe8dc17d.invoke(<generated>)
 at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
 at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783)
 at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
 at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753)
 at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:89)
 at com.whaleal.ops.web.api.config.PerformanceAspect.servicePerformance(PerformanceAspect.java:61)
 at sun.reflect.NativeMethodAccessorImp

一份链接 出现链接成功信息。也出现了拒绝链接信息

2022-01-04 10:36:04.917  INFO 43740 --- [168.3.100:47018] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:1, serverValue:9655}] to 192.168.3.100:47018
2022-01-04 10:36:04.917  INFO 43740 --- [168.3.100:47018] org.mongodb.driver.connection            : Opened connection [connectionId{localValue:2, serverValue:9654}] to 192.168.3.100:47018
2022-01-04 10:36:04.918  INFO 43740 --- [168.3.100:47018] org.mongodb.driver.cluster               : Monitor thread successfully connected to server with description ServerDescription{address=192.168.3.100:47018, type=REPLICA_SET_PRIMARY, state=CONNECTED, ok=true, minWireVersion=0, maxWireVersion=13, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=19937247, setName='myReplicaSet40', canonicalAddress=server100:47018, hosts=[server100:47018], passives=[], arbiters=[], primary='server100:47018', tagSet=TagSet{[]}, electionId=7fffffff0000000000000015, setVersion=5, topologyVersion=TopologyVersion{processId=61cd7e155bce9add441afa96, counter=6}, lastWriteDate=Tue Jan 04 10:36:05 CST 2022, lastUpdateTimeNanos=620983328823443}
2022-01-04 10:36:04.952  INFO 43740 --- [           main] org.mongodb.driver.cluster               : Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms'}
2022-01-04 10:36:04.956  INFO 43740 --- [localhost:27017] org.mongodb.driver.cluster               : Exception in monitor thread while connecting to server localhost:27017

com.mongodb.MongoSocketOpenException: Exception opening socket
	at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:70) ~[mongodb-driver-core-4.2.3.jar:na]
	at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:143) ~[mongodb-driver-core-4.2.3.jar:na]
	at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.lookupServerDescription(DefaultServerMonitor.java:188) ~[mongodb-driver-core-4.2.3.jar:na]
	at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:144) ~[mongodb-driver-core-4.2.3.jar:na]
	at java.base/java.lang.Thread.run(Thread.java:829) ~[na:na]
Caused by: java.net.ConnectException: Connection refused (Connection refused)
	at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:na]
	at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399) ~[na:na]
	at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242) ~[na:na]
	at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224) ~[na:na]
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:na]
	at java.base/java.net.Socket.connect(Socket.java:609) ~[na:na]
	at com.mongodb.internal.connection.SocketStreamHelper.initialize(SocketStreamHelper.java:107) ~[mongodb-driver-core-4.2.3.jar:na]
	at com.mongodb.internal.connection.SocketStream.initializeSocket(SocketStream.java:79) ~[mongodb-driver-core-4.2.3.jar:na]
	at com.mongodb.internal.connection.SocketStream.open(SocketStream.java:65) ~[mongodb-driver-core-4.2.3.jar:na]
	... 4 common frames omitted

mars-springboot 模块优化建议

1 减少对 现有spring-boot-autoconfigure 的依赖
目前 spring-boot-autoconfigure 内置有 mongodb 驱动 ,可能会遇到 与 mars 内置驱动版本不一致的情况
这会导致 生成因为 spring 相关注入 原生的MongoClient 等前置依赖 失败 。最终导致Mars 的注入失败 。
所以需要剥离开 只依赖一些 配置文件 。

2 补充说明 在 spring-boot 项目中 MongoDB 的版本会被 spring - parent 依赖的数据库版本覆盖 。

TestMongId 方法异常

12:55:14.514 [cluster-ClusterId{value='61d3d33213f3d12d9a9197ef', description='null'}-192.168.3.134:37017] DEBUG org.mongodb.driver.cluster - Updating cluster description to {type=REPLICA_SET, servers=[{address=192.168.3.26:37017, type=REPLICA_SET_OTHER, roundTripTime=13.7 ms, state=CONNECTED}, {address=192.168.3.134:37018, type=REPLICA_SET_ARBITER, roundTripTime=106.8 ms, state=CONNECTED}, {address=192.168.3.134:37017, type=REPLICA_SET_PRIMARY, roundTripTime=109.5 ms, state=CONNECTED}]
Tests run: 4, Failures: 0, Errors: 4, Skipped: 0, Time elapsed: 0.037 sec <<< FAILURE!
arrayFieldMapping(com.whaleal.mars.core.codecs.TestMongId) Time elapsed: 0.022 sec <<< ERROR!
java.lang.NullPointerException
at com.whaleal.mars.core.codecs.TestMongId.arrayFieldMapping(TestMongId.java:33)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

basicFieldMapping(com.whaleal.mars.core.codecs.TestMongId) Time elapsed: 0 sec <<< ERROR!
java.lang.NullPointerException
at com.whaleal.mars.core.codecs.TestMongId.basicFieldMapping(TestMongId.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

idFieldMapping(com.whaleal.mars.core.codecs.TestMongId) Time elapsed: 0.003 sec <<< ERROR!
java.lang.NullPointerException
at com.whaleal.mars.core.codecs.TestMongId.idFieldMapping(TestMongId.java:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

collectionFieldMapping(com.whaleal.mars.core.codecs.TestMongId) Time elapsed: 0.006 sec <<< ERROR!
java.lang.NullPointerException
at com.whaleal.mars.core.codecs.TestMongId.collectionFieldMapping(TestMongId.java:54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

$Lookup(聚合)中缺少实现方法

在执行聚合操作时,$lookup内部的pipeline没有实现方法

预期执行的语句
db.orders.aggregate( [
{
$lookup:
{
from: "warehouses",
let: { order_item: "$item", order_qty: "$ordered" },
pipeline: [
{ $match:
{ $expr:
{ $and:
[
{ $eq: [ "$stock_item", "$$order_item" ] },
{ $gte: [ "$instock", "$$order_qty" ] }
]
}
}
},
{ $project: { stock_item: 0, _id: 0 } }
],
as: "stockdata"
}
}
] )

$out(聚合)不支持插入到外部数据库中

在指定out属性时,使用Out.to("")生成Out对象,不能指定数据库
db.getSiblingDB("test").books.aggregate( [
{ $group : { _id : "$author", books: { $push: "$title" } } },
{ $out : { db: "reporting", coll: "authors" } }
] )

Save 方法待优化

当前 处理过程 如果不是实体的话 就会直接转为 insert ,因为非实体 是不会检测 _id 字段
比如 document 类型 {_id:xxxx} 时 就会直接插入 ,从而导致 插入异常
不是特别合理 。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.