How to use the MinKey function from bson
Find comprehensive JavaScript bson.MinKey code examples handpicked from public code repositorys.
28 29 30 31 32 33 34 35 36 37
```javascript // Example schema with a field default set to MinKey const mySchema = new Schema({ name: String, priority: { type: Schema.Types.MinKey, default: new MinKey() }, }); ``` - When you need to find a document with the minimum value for a specific field.
428
0
84
+ 27 other calls in file
0 1 2 3 4 5 6 7 8 9 10
'use strict'; const expect = require('chai').expect; const bson = require('bson'); const ObjectId = bson.ObjectId; const MinKey = bson.MinKey; const MaxKey = bson.MaxKey; const Binary = bson.Binary; const BSONRegExp = bson.BSONRegExp; const Code = bson.Code;
121
761
0
+ 7 other calls in file
GitHub: loongson/npm-registry
56 57 58 59 60 61 62 63 64 65
/** @type {import('bson').Map} */ module.exports.Map = BSONJS.Map; /** @type {import('bson').MaxKey} */ module.exports.MaxKey = BSONJS.MaxKey; /** @type {import('bson').MinKey} */ module.exports.MinKey = BSONJS.MinKey; /** @type {import('bson').ObjectId} */ module.exports.ObjectId = BSONJS.ObjectId; /** @type {import('bson').BSONRegExp} */ module.exports.BSONRegExp = BSONJS.BSONRegExp;
0
0
0
+ 12 other calls in file
148 149 150 151 152 153 154 155 156 157
const result = libBson.toString(test); expect(result).to.eql('{\n symbol: {\n value: \'test\'\n }\n}'); }); it('should convert MinKey to string', function () { const test = { key: new bson.MinKey() }; const result = libBson.toString(test); const test2 = libBson.toBSON(result); expect(test2).to.eql(test);
0
0
0
bson.ObjectId is the most popular function in bson (1017 examples)