Documents and BSON

BSON types, Extended JSON, the comparison order and collation, as in MongoDB.

TeselaDB stores BSON documents with all their types: double, string, document, array, binary, ObjectId, boolean, date, null, regular expression, JavaScript, int, long, Decimal128, Timestamp, MinKey and MaxKey. What your driver writes is exactly what it reads back.

Extended JSON

The tools that speak JSON (mongoexport, mongoimport, the REST API) use Extended JSON v2 in its canonical and relaxed modes, with the same rules as MongoDB.

Comparison order

Two values of different types compare by type and then by value, in MongoDB's order: MinKey, null, numbers, strings, documents, arrays, binaries, ObjectId, booleans, dates, Timestamp, regular expressions and MaxKey. Numbers compare by value even when their types differ.

Collation

Text comparisons with collation use the same Unicode data as MongoDB 9.0 (ICU 57.1), so the order and equality of strings with accents, case or other scripts match MongoDB's.

JavaScript
db.customers.find({ surname: "lópez" }).collation({ locale: "es", strength: 1 });

What changes from MongoDB

  • A string or field name that is not valid UTF-8 is rejected with InvalidBSON (22). MongoDB stores it.
  • A find without sort returns documents in the order of their key within the range, not in insertion order. MongoDB guarantees no order without sort; if your application needs one, ask for it with sort.