skip to Main Content

Mongodb – How to find unique couples in mongo

I'm inserting these documents: db.users.insert({user1: 'a',user2: 'b'}); db.users.insert({user1: 'b',user2: 'a'}); db.users.insert({user1: 'c',user2: 'd'}); db.users.insert({user1: 'd',user2: 'c'}); Please note that user1 and user2 are actually ObjectId, but I'm writing them as single char to better explain the issue. I need to…

VIEW QUESTION

Mongodb – mongoose code showing error of a call ack function

app.post ('/create_contact',function(req,res) { contact.create({ name :req.body.name, phone:req.body.phone },function(err,newContact) { if(err){console.log('error in creating a contact!'); return;} console.log('********',newContact); return res.redirect('back'); }); }); Errors: throw new MongooseError('Model.create() no longer accepts a callback'); ^ MongooseError: Model.create() no longer accepts a callback I tried this…

VIEW QUESTION

Mongodb – FindOne and sort in array with Mongoose

How can i get sorted data in array by "name" in categories where '_id = 63fe948a22009cbbba53b905'? My sample data: { "_id": "63fe948a22009cbbba53b905", "options": { "sort": "manual" }, "categories": [ { "priority": 0, "options": "manual", "name": "Nazwa 1", "_id": "63fe8cc76d50062ae1f53821" },…

VIEW QUESTION

How to fix that type of error when I try to run command "mongod" for MongoDB

mongod {"t":{"$date":"2023-03-01T16:14:48.163+00:00"},"s":"I", "c":"NETWORK", "id":4915701, "ctx":"-","msg":"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":17},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":17},"outgoing":{"minWireVersion":6,"maxWireVersion":17},"isInternalClient":true}}} {"t":{"$date":"2023-03-01T16:14:48.167+00:00"},"s":"I", "c":"CONTROL", "id":23285, "ctx":"-","msg":"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"} {"t":{"$date":"2023-03-01T16:14:48.181+00:00"},"s":"I", "c":"NETWORK", "id":4648602, "ctx":"thread1","msg":"Implicit TCP FastOpen in use."} {"t":{"$date":"2023-03-01T16:14:48.185+00:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","namespace":"config.tenantMigrationDonors"}} {"t":{"$date":"2023-03-01T16:14:48.185+00:00"},"s":"I", "c":"REPL", "id":5123008, "ctx":"thread1","msg":"Successfully registered…

VIEW QUESTION
Back To Top
Search