//Below line of code works fine with the result,
//maxBSONValue: org.mongodb.scala.bson.BsonObjectId = BsonObjectId{value=572865049229f27baf82c974}
val maxBSONValue = org.mongodb.scala.bson.BsonObjectId("572865049229f27baf82c974")
//Subsequent execution of below line results in error
//error: org.mongodb.scala.bson.BsonObjectId.type does not take parameters
val minBSONValue = org.mongodb.scala.bson.BsonObjectId("572865049229f27baf82c96f")
Why BsonObjectId::apply(String) method does not work for the second time?
Instead of invoking apply() method from the BsonObjectId companion object (here), it seems to be seeing BsonObjectId as a type (defined here) and it complains that it doesn't take parameters (which is true). This is the cause of your error message. Not sure why it's happening though. Check out this question and see if you can find something useful (I didn't really dig too deep into it).
Sorry for posting as answer even though it isn't really one, but I think it could put you on the right track and I couldn't fit it into comments.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With