3 examples of 'mongodb query array of objects' in JavaScript

Every line of 'mongodb query array of objects' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
87function queryByObject(collection, query) {
88 var keys = Object.keys(query);
89
90 // Match properties of query against objects in the collection.
91 return keys.length === 0 ?
92 collection.slice() :
93 collection.filter(function(object) {
94 return queryObject(object, query, keys);
95 }) ;
96}
49async findManyById(ids: string[]): Promise {
50 const collection = await this.collection;
51 const found = await collection.find({ _id: { $in: ids.map(id => new ObjectID(id)) } }).toArray();
52
53 const results: DOC[] = [];
54 for (const result of found) {
55 results.push(await this.invokeEvents(POST_KEY, ['find', 'findMany'], this.toggleId(result, false)));
56 }
57
58 return results;
59}
555private _queryOnObjects(objects: CoatyObject | CoatyObject[] | Uuid | Uuid[], text: string): Promise {
556 const values = this._getQueryValuesOnObjects(objects);
557 if (values.length === 0) {
558 return Promise.resolve([]);
559 }
560
561 return this._getQueryable().query(text, values).then(result => result.rows.map(row => row.objectid));
562}

Related snippets