Р
ШоОниСебеПозволяют?!
Size: a a a
Р
BK
Ш
MB
DD
const mongodb = require('mongodb');
const client = new mongodb.MongoClient('localhost');
/**
* @typedef {Object} Test
* @property {string} tagsString
* @property {'tag1' | 'tag2' | 'tag3'} tagsUnion
*/
/**
* @typedef { import('mongodb').Collection<Test> } TestCollection
*/
(async () => {
await client.connect();
const db = client.db('test');
/** @type {TestCollection} */
const collection = db.collection('test');
collection.find({
tagsString: { $all: ['str'] },
tagsUnion: { $all: ['ta2'] }, // do not check union, but know about $all keyword
$and: [{ tagsUnion: '' }] // check union
});
})();
DD
TS
const mongodb = require('mongodb');
const client = new mongodb.MongoClient('localhost');
/**
* @typedef {Object} Test
* @property {string} tagsString
* @property {'tag1' | 'tag2' | 'tag3'} tagsUnion
*/
/**
* @typedef { import('mongodb').Collection<Test> } TestCollection
*/
(async () => {
await client.connect();
const db = client.db('test');
/** @type {TestCollection} */
const collection = db.collection('test');
collection.find({
tagsString: { $all: ['str'] },
tagsUnion: { $all: ['ta2'] }, // do not check union, but know about $all keyword
$and: [{ tagsUnion: '' }] // check union
});
})();
AG
DD
Т
NG
Т
Т
ET
DD
AG
VN
VN
TS
S