Mongoose return all documents that contain a value wherever inside a property

Advertisements Lets say my documents look like this : _id: "6285e9a7aff93ead37ec50ad", date: "2022-04-28T10:51:37.923Z", devices: { tablets: [ { brand: "samsung", model: "s20" }, { brand: "samsung", model: "s21" }, { brand: "apple", model: "ipad_mini" }, ], phones: [ { brand: "samsung", model: "galaxy_s20" }, { brand: "samsung", model: "galaxy_s20_lite" } ], laptops: [] } }… Read More Mongoose return all documents that contain a value wherever inside a property

Unable to retrieve multiple values from database

Advertisements The following data exists in the database: [ { "_id": { "$oid": "628c787de53612aad30021ab" }, "ticker": "EURUSD", "dtyyyymmdd": "20030505", "time": "030000", "open": "1.12161", "high": "1.12209", "low": "1.12161", "close": "1.12209", "vol": "561", "id": 1 }, { "_id": { "$oid": "628c787de53612aad30021ac" }, "ticker": "EURUSD", "dtyyyymmdd": "20030505", "time": "030100", "open": "1.12206", "high": "1.1225", "low": "1.12206", "close": "1.1225", "vol":… Read More Unable to retrieve multiple values from database

How do I summarize tags by category in mongodb

Advertisements I have a collection that is shaped like this: [ { _id: ObjectId("5d8e8c9b8f8b9b7b7a8b4567"), tags: { language: [ ‘en’ ], industries: [ ‘agency’, ‘travel’ ], countries: [ ‘ca’, ‘us’ ], regions: [ ‘north-america’ ], } }, { _id: ObjectId("5d8e8c9b8f8b9b7b7a8b4568"), tags: { language: [ ‘en’, ‘fr’ ], industries: [ ‘travel’ ], countries: [ ‘ca’ ] }… Read More How do I summarize tags by category in mongodb

Laravel Getting id's from a table and inserting them into another table

Advertisements Trying to get matching id’s from a table and inserting them again in the same table under differnet relationship. $contentPack = ContentPack::find($id); $cloned_pack_goals = DB::table(‘content_pack_goal’)->where(‘content_pack_id’ , $contentPack->id)->get(); $cloned_pack_goal_ids = $cloned_pack_goals->goal_id; Produces Exception Exception Property [goal_id] does not exist on this collection instance. dd($cloned_pack_goals); outputs: Illuminate\Support\Collection {#2466 ▼ #items: array:2 [▼ 0 => {#3129 ▼… Read More Laravel Getting id's from a table and inserting them into another table

Java Generics: Stream toArray()

Advertisements Given a simple generic class: private static class Container<T> { private List<T> aList; private T aValue; private Container(List<T> aList, T aValue) { this.aList = aList; this.aValue = aValue; } } Initialize a list of that class: List<Container<?>> container = new ArrayList<>(); // Add some elements… Not possible (The method toArray(IntFunction<A[]>) in the type Stream<List<capture#1-of… Read More Java Generics: Stream toArray()