com.mongodb.MongoCommandException: Command failed with error 15990: 'exception: this object is already an operator expression, and can't be used as a document expression (at 'then')' on server 192.168.1.127:27017. The full response is { "errmsg" : "exception: this object is already an operator expression, and can't be used as a document expression (at 'then')", "code" : 15990, "ok" : 0.0 }

Stack Overflow | radhakrishnan | 5 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    MongoDB Aggregation command to Java code

    Stack Overflow | 5 months ago | radhakrishnan
    com.mongodb.MongoCommandException: Command failed with error 15990: 'exception: this object is already an operator expression, and can't be used as a document expression (at 'then')' on server 192.168.1.127:27017. The full response is { "errmsg" : "exception: this object is already an operator expression, and can't be used as a document expression (at 'then')", "code" : 15990, "ok" : 0.0 }

    Root Cause Analysis

    1. com.mongodb.MongoCommandException

      Command failed with error 15990: 'exception: this object is already an operator expression, and can't be used as a document expression (at 'then')' on server 192.168.1.127:27017. The full response is { "errmsg" : "exception: this object is already an operator expression, and can't be used as a document expression (at 'then')", "code" : 15990, "ok" : 0.0 }

      at com.mongodb.connection.ProtocolHelper.getCommandFailureException()
    2. MongoDB Java Driver
      AggregateIterableImpl.forEach
      1. com.mongodb.connection.ProtocolHelper.getCommandFailureException(ProtocolHelper.java:115)
      2. com.mongodb.connection.CommandProtocol.execute(CommandProtocol.java:114)
      3. com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:159)
      4. com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:286)
      5. com.mongodb.connection.DefaultServerConnection.command(DefaultServerConnection.java:173)
      6. com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:215)
      7. com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:206)
      8. com.mongodb.operation.CommandOperationHelper.executeWrappedCommandProtocol(CommandOperationHelper.java:112)
      9. com.mongodb.operation.AggregateOperation$1.call(AggregateOperation.java:227)
      10. com.mongodb.operation.AggregateOperation$1.call(AggregateOperation.java:223)
      11. com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:239)
      12. com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:212)
      13. com.mongodb.operation.AggregateOperation.execute(AggregateOperation.java:223)
      14. com.mongodb.operation.AggregateOperation.execute(AggregateOperation.java:65)
      15. com.mongodb.Mongo.execute(Mongo.java:772)
      16. com.mongodb.Mongo$2.execute(Mongo.java:759)
      17. com.mongodb.OperationIterable.iterator(OperationIterable.java:47)
      18. com.mongodb.OperationIterable.forEach(OperationIterable.java:70)
      19. com.mongodb.AggregateIterableImpl.forEach(AggregateIterableImpl.java:117)
      19 frames
    3. threadpack
      queryBtDates.main
      1. threadpack.queryBtDates.main(queryBtDates.java:88)
      1 frame