MONGOC_MATCHER(3)

πŸ“¦
version 1.23.1 Β· 2 versions
, in debian bookworm

πŸ’– MONGOC_MATCHER πŸ’–

okay bestie, pull up a chair because we're talking about mongoc_matcher from libmongc... no wait, libmongoc 🫢 the MongoDB C driver's own little manual page. this one's about Client Side Document Matching and it is so niche but also kinda iconic. let's get into it ✨


✨ NAME ✨

mongoc_matcher β€” Client Side Document Matching πŸŽ€


🌸 BASIC DOCUMENT MATCHING (DEPRECATED) 🌸

⚠️ WARNING: This feature will be removed in version 2.0. it's giving "enjoy it while it lasts" energy, bestie πŸ’€

so. the MongoDB C driver can match a subset of the MongoDB query specification on the client. like, right there on your machine, no server round-trip, no waiting, main character energy fr fr πŸ‘‘

currently supported, and I'm listing every single one because we don't skip:

  • basic numeric equality
  • basic string equality
  • basic subdocument equality
  • basic array equality
  • $gt
  • $gte
  • $lt
  • $lte
  • $in
  • $nin
  • $ne
  • $exists
  • $type
  • $and
  • $or

that's the whole lineup, periodt πŸ’…

now the real talk: this is not the same implementation as the MongoDB server, so some inconsistencies may occur. lowkey expected when two things do the same job in different ways, right? πŸ™ˆ and if you do find one of those inconsistent cases, pls file a bug β€” the maintainers wanna know, I promise, no cap πŸ¦‹


🧚 how to actually test this 🧚

the move is to do a mongodump of a single collection and pipe it into the program. chef's kiss, honestly πŸ“

$ echo "db.test.insert({hello:'world'})" | mongo
connecting to: test
WriteResult({ "nInserted" : 1 })
bye

$ mongodump -d test -c test -o - | filter-bsondump
{ "_id" : { "$oid" : "537afac9a70e5b4d556153bc" }, "hello" : "world" }

look at that output. { "hello" : "world" } sitting there looking all cute. that's the vibe check passing βœ…


⭐ AUTHOR ⭐

MongoDB, Inc 🌈


2017-present, MongoDB, Inc πŸ’œ


and that's the whole page, bestie!! mwah πŸ’‹ this was libmongoc version 1.23.1, dated Apr 27, 2026 β€” go forth and match some documents on the client side before 2.0 takes it away πŸ˜­πŸ’–

πŸ“¦ where this page comes from