How to use the BSONRegExp function from bson

Find comprehensive JavaScript bson.BSONRegExp code examples handpicked from public code repositorys.

176
177
178
179
180
181
182
183
184
185
  );
  return bson.Long.fromBits(...rhs);
}

emitRegex(ctx, pattern, flags) {
  return new bson.BSONRegExp(pattern, flags);
}

emit_array(ctx) {
  ctx.type = this.Types._array;
fork icon128
star icon793
watch icon35

3
4
5
6
7
8
9
10
11
12
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;
const Timestamp = bson.Timestamp;
const Long = bson.Long;
const Double = bson.Double;
fork icon121
star icon761
watch icon0

+ 7 other calls in file

60
61
62
63
64
65
66
67
68
69
/** @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;
/** @type {import('bson').BSONSymbol} */
module.exports.BSONSymbol = BSONJS.BSONSymbol;
/** @type {import('bson').Timestamp} */
module.exports.Timestamp = BSONJS.Timestamp;
fork icon0
star icon0
watch icon0

+ 12 other calls in file

154
155
156
157
158
159
160
161
162
163
  a: 12,
  b: new BSON.Int32(12),
  c: new BSON.Long(12),
  d: new BSON.Double(12),
  e: /[A-Za-z0-9]*/,
  f: new BSON.BSONRegExp('[A-Za-z0-9]*'),
  g: undefined
};

const expected = BSON.deserialize(BSON.serialize(data, bsonOptions), bsonOptions);
fork icon0
star icon0
watch icon0

+ 3 other calls in file