How to use $lookup in Angular2-Meteor

Issue I get this error when using $lookup operator in angular2-meteor: Exception from sub tasks id bAJHF7MZzEidGBZ63 Error: Exception while polling query { “collectionName”: “tasks”, “selector”: { “$lookup”: { “from”: “projects”, “localField”: “project._id”, “foreignField”: “_id”, “as”: “proj” } }, “

Continue reading

Nested Models in Loopback Android SDK

Issue I have a loopback instance with MongoDB backend, and have defined a model that has a nested (anonymous) model called ‘location’ as a property: “name”: “thing”, “plural”: “things”, “base”: “PersistedModel”, “idInjection”: true, “options”: { “validateUpsert”: true }, “properties”: {

Continue reading

Weird scope behavior in node or am I sleeping?

Issue My js is as follows, /* * GET home page. */ var MongoClient = require(‘mongodb’); exports.index = function(req, res){ var studentObj = {}; MongoClient.connect(“mongodb://localhost:27017/MY_DB_TEST”, function(err, db) { if(!err) { console.log(“We are connected”); var collection = db.collection(‘test’); var stream =

Continue reading

Unable to fill mongodb document with external api data

Issue I am trying to fill my mongodb document with data from unsplash and randomuser api. const userdata = await axios.get("https://randomuser.me/api/?results=51"); const imagedat = await axios.get( "https://api.unsplash.com/photos/random/?count=51&client_id=GWDzPpjHk743C2QnVBRxu8PtmOI3npF5sePZZ7o0pg4" ); I call both apis for 51 results but after 22 results the

Continue reading

Group documents in two by array field Mongo Aggregation

Issue How do I group the date field one to the next one in each document? { _id: ObjectId(‘…’), date: [ISODate(‘2022-05-27T00:00:00.000+00:00’), ISODate(‘2022-05-28T00:00:00.000+00:00’) …] } The desired document would like this: { _id: ObjectId(‘…’), date1: ISODate(‘2022-05-27T00:00:00.000+00:00’), date2: ISODate(‘2022-05-28T00:00:00.000+00:00′) } Solution Here’s

Continue reading

Mongoose where value in array

Issue I have the below code to return all blogs where the blog author ID is equal to the ID of the first administrator (orgAdmin) in an array: let officialBlogs = await Blog.find().where(‘author.id’).equals(help.orgAdmins[0]); But I can’t work out how to

Continue reading

using ObjectId as a data type

Issue I’m trying to create a schema for an object and I’m using ObjectId as type but he gives me an error const mongoose = require("mongoose"); const permissionsSchema = new mongoose.Schema({ roleId: { type: ObjectId, required: true, }, menuPageId: {

Continue reading

MongoDB showing the schema as undefined

Issue While retrieving documents from database values are shown as undefined in console log. Piece of code that causing that issue. const stockSchema = mongoose.Schema({ rollingStockNumber: String, docs: { naturka: String, address: String, coefficient: String, wheel: String, weight: Number }

Continue reading