Ivan “CLOVIS” Canet

Ivan “CLOVIS” Canet

@ivcanet.bsky.social

Kotlin developer & teacher @ 4SH, learn more about me: ivan.canet.dev Open source at https://opensavvy.dev • @opensavvy.techhub.social.ap.brid.gy Organizing the Kotlin Bordeaux User Group at https://bordeauxkt.io

362 Followers 296 Following 1,072 Posts Joined Sep 2023
16 hours ago

(btw the official Java & Kotlin drivers have the same problem)

0 0 0 0
16 hours ago

I'm a bit stuck, because I want to display JSON to users, but the specified JSON is a valid two-way equivalent to the query :/

0 0 1 0
16 hours ago

See how there's a $regularExpression object that appeared out of nowhere?

This is the official JSON equivalent. But it's not recognized by MongoDB editors. So if you copy-paste it there, it sends the full structure to MongoDB, which is not one of the valid syntaxes.

0 0 1 0
16 hours ago
{
	"name": {
		"$regex": {
			"$regularExpression": {
				"pattern": "foo.*",
				"options": ""
			}
		}
	}
}

Note how the native type is writte: /pattern/<options>.

This isn't actually MongoDB syntax, it's JS! If you're not using JS, that's not legal for you.

Worst, this is *not* how the RegExp BSON type is specified to be rendered to JSON. Here it is:

github.com/mongodb/spec...

0 1 2 0
16 hours ago
Syntax
To use $regex, use one of the following syntaxes:

{ <field>: { $regex: /pattern/, $options: '<options>' } }

{ "<field>": { "$regex": "pattern", "$options": "<options>" } }

{ <field>: { $regex: /pattern/<options> } }

This happens because of the JSON conversion rules of native BSON types.

For example, with RegExp.

The query operator $regex accepts three syntaxes. Two that takes strings, and one that accepts a BSON RegExp type.

www.mongodb.com/docs/manual/...

0 0 1 0
16 hours ago

With KtMongo, I strive to:

• Each KtMongo class should have a toString() that shows what you need to copy-paste into a MongoDB editor to make the same query
• The toString() should follow the BSON specification

Turns out, these two points are incompatible!

#mongodb

1 0 1 0
21 hours ago
Post image

👀

2 0 0 0
1 day ago

With that, links in module pages are now finally resolved correctly.

1 0 0 0
1 day ago

Finally managed to get the Dokka aggregation plugin to work!

This will break all existing URLs, but that's why the project is marked experimental.

Before:
/api/-mongo-d-b%20request%20-d-s-l/opensavvy.ktmongo.dsl/-bson-context.html

After:
/api/dsl/opensavvy.ktmongo.dsl/-bson-context.html

2 0 1 0
2 days ago

I'm making big progress in the Dokka Material MkDocs integration 👀

2 0 0 0
3 days ago

(yes it says error in the sitemap, but in the sitemap's page it says success)

1 0 0 0
3 days ago
Post image

Google still doesn't think it's worth indexing though

1 0 0 0
3 days ago

The peak around the 3rd is. The big one is the mandatory varargs one.

1 0 2 0
3 days ago
pages:deploy - artifacts for pages are too large: 1140337758

ah. That's not good.

1 0 0 0
3 days ago
Post image

Okay I guess people prefer shorter articles 😅

2 0 1 0
4 days ago

The cache usage of GitLab CI runners is insane.

I just cleared 250 GB of storage from 8 days of CI execution!

2 0 0 0
5 days ago
Preview
Kotlin tricks: Mandatory varargs - Ivan “CLOVIS” Canet Software engineering, open source and computer security

New article!

Did you know #Kotlin has mandatory varargs?

ivan.canet.dev/blog/2026/03...

11 4 2 1
5 days ago

Having talked to a few teachers, the secret seems to be ‘have all the grades be based on oral exams’.

Maybe they can't write the code, but if they can understand what the LLM wrote, that's still a skill.

2 0 0 0
6 days ago

Technically not, but it's very useful as ‘recursive navigate to usage’

1 0 0 0
6 days ago

My favorite is ‘data flow to here’ which isn't even in this popup

0 0 1 0
6 days ago

(note also that in the Kotlin version, the argument to the lambda is implicit for these methods, this is another language feature: these are extension lambdas, not regular ones, which implicitly expose the instance they're called on)

Together, these features allow very expressive and concise DSLs

0 0 0 0
6 days ago

In Rust, this would look like

let retry = pipeline.job(build, |job| {
job.script(|script| {
script.shell("...");
});

job.retry(2, |reason| {
reason.onExitCode(127);
});
});

(Sorry if it's not exact, I haven't written Rust in a while)

0 0 1 0
6 days ago
			// Retry with when type
			val retryWithWhen by job(stage = build) {
				script {
					shell("echo 'Retry with when type test'")
				}
				retry(2) {
					on(RetryCause.RunnerSystemFailure)
				}
			}

			// Retry with multiple when types
			val retryWithMultipleWhen by job(stage = build) {
				script {
					shell("echo 'Retry with multiple when types test'")
				}
				retry(2) {
					on(RetryCause.RunnerSystemFailure)
					on(RetryCause.ApiFailure)
				}
			}

Other people have already answered the questions, but I wanted to share an example of how it looks like in practice

Each call is a function + the lambda it receives, it's very convenient to concisely describe complex structures (here, GitLab CI config instead of YAML)

0 0 1 0
6 days ago

Like, Git isn't a blockchain, but it's decentralized and there's an append-only ledger, so if I were mandated to use blockchain tools just because it's the hype, then I'd claim Git counts

1 0 1 0
6 days ago

I wish we had nice well-defined terms to talk about stuff, but I also much prefer branding a feature that works as the buzzword-of-the-moment than actually having it be rewritten as a worse version using an unrelated tech just because it's in the hyper circle

1 0 1 0
6 days ago

It is also a way of riding the hype. If rebranding an existing feature as ‘AI’ even though it's just a basic predictive algorithm makes it sell more and makes the clients happy...

2 0 1 0
1 week ago
NextCloud notification with 3 quick actions: cancel, cancel & cancel.

Okayyy, I get it

3 0 3 0
1 week ago

Challenge for people who believe Claude *is* conscious and use it anyway: Explain how you’re not a slaver.

2,549 548 74 24
1 week ago

I'm nominated in ‘online presence’, vote for me!

3 0 0 0
1 week ago
‘Humans use Energy and Water too’ An engineer I admire was lamenting about AI. He said that his new programming agent is excellent at fixing bugs! And all that it costs is a bunch of energy and many litres of water. He said that he co...

✊🏻

23 8 0 2