anonimongo icon indicating copy to clipboard operation
anonimongo copied to clipboard

Makes it compile with nim 2.1.99 #fixes #36

Open jmgomez opened this issue 1 year ago • 7 comments

jmgomez avatar Sep 21 '24 00:09 jmgomez

Tried running this with nimble test got this message:

~/anonimongo/tests/utils_test.nim(78, 34) template/generic instantiation of `newMongo` from here
~/anonimongo/src/anonimongo/core/types.nim(306, 17) Error: ambiguous identifier: 'Uri' -- use one of the following:
  uri.Uri: Uri
  QKind.URI: QKind

I think it's because the uri variable defined above it make it ambiguous to use it as uri.Uri.

mashingan avatar Oct 03 '24 13:10 mashingan

Tried running this with nimble test got this message:

~/anonimongo/tests/utils_test.nim(78, 34) template/generic instantiation of `newMongo` from here
~/anonimongo/src/anonimongo/core/types.nim(306, 17) Error: ambiguous identifier: 'Uri' -- use one of the following:
  uri.Uri: Uri
  QKind.URI: QKind

I think it's because the uri variable defined above it make it ambiguous to use it as uri.Uri.

Yes. Thats why I moved it to the top in one of the changes. I missed that one because I couldnt get the test to work in local and it seems that the error you are seeing didnt trigger by my use case

jmgomez avatar Oct 03 '24 16:10 jmgomez

It's solved by adjusting to uri.Uri so it won't be ambiguous anymore.

Also, at very least you should run nim r tests/test_bson_test.nim to check if it's breaking or not due to version upgrade. This won't boot up mongod child process and simply tests for BSON module.

In case you want to test for most of db commands, you can set your config.nims like in this github action setting. As long the standalone test is completed, whether success or failed, it will kill the booted mongod child process.

mashingan avatar Oct 10 '24 15:10 mashingan

I will test soon, what is the status, was the Uri.uri adjusted? did it work?

samsamros avatar Oct 12 '24 20:10 samsamros

No, not yet. The regressions are more than that.

mashingan avatar Oct 12 '24 23:10 mashingan

I'm testing these changes... they seem to work fine on some of my applications. I'm still debugging other issues and going really slow, but these changes appear to work fine so far. Has anyone else done any testing for this branch?

Update when running testing:

/home/testing/shared/anonimongo/tests/test_bson_test.nim(24, 27) Error: type mismatch
Expression: newbson([("hello", toBson(100)), ("array world", bsonArray(["red", 50, 4.2])),
         ("hello world", toBson(isekai))])
  [1] [("hello", toBson(100)), ("array world", bsonArray(["red", 50, 4.2])),
 ("hello world", toBson(isekai))]: array[0..2, (string, BsonBase)]

Expected one of (first mismatch at [position]):
[1] proc newBson(first: (string, BsonBase); table: varargs[(string, BsonBase)]): BsonDocument
[1] proc newBson(table = newOrderedTable[string, BsonBase]();
             stream: Streamable = newStream(); filename = ""): BsonDocument

       Tip: 55 messages have been suppressed, use --verbose to show them.
tools.nim(36)            doCmd

    Error:  Execution failed with exit code 1

which I managed to change by explicitly adding table = newOrderedTable([...])

there are other issues I'm still testing, specifically regarding the Time type.

samsamros avatar Dec 15 '24 01:12 samsamros

I'm testing these changes... they seem to work fine on some of my applications. I'm still debugging other issues and going really slow, but these changes appear to work fine so far. Has anyone else done any testing for this branch?

Update when running testing:

/home/testing/shared/anonimongo/tests/test_bson_test.nim(24, 27) Error: type mismatch
Expression: newbson([("hello", toBson(100)), ("array world", bsonArray(["red", 50, 4.2])),
         ("hello world", toBson(isekai))])
  [1] [("hello", toBson(100)), ("array world", bsonArray(["red", 50, 4.2])),
 ("hello world", toBson(isekai))]: array[0..2, (string, BsonBase)]

Expected one of (first mismatch at [position]):
[1] proc newBson(first: (string, BsonBase); table: varargs[(string, BsonBase)]): BsonDocument
[1] proc newBson(table = newOrderedTable[string, BsonBase]();
             stream: Streamable = newStream(); filename = ""): BsonDocument

       Tip: 55 messages have been suppressed, use --verbose to show them.
tools.nim(36)            doCmd

    Error:  Execution failed with exit code 1

which I managed to change by explicitly adding table = newOrderedTable([...])

there are other issues I'm still testing, specifically regarding the Time type.

Update:

I've been trying to run the tests. there are multiple errors in the test_bson_test.nim. However, I've also been conducting tests on some of my applications as I slowly debug the multiple broken code from updating to 2.2.0. With this PR it seems to work fine.

Times and Ints seem to be the major issue... we may need to go through all of these issues to test the macros.

samsamros avatar Dec 17 '24 15:12 samsamros