Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- user = {
- "userId" : "myId",
- "connections":
- [{
- "dateConnectedUnix": 1334567891,
- "isActive": true
- }, {
- "dateConnectedUnix": 1334567893,
- "isActive": false
- }]
- }
- user = {
- "userId" : "myId",
- "connections":
- [{
- "dateConnectedUnix": 1334567893,
- "isActive": false
- }]
- }
- userAccounts.update({'connections.isActive': false },
- {$pull: { 'connections.isActive':false }},
- function (err,val) {
- console.log(val)
- });
- userAccounts.update({'connections._id': '1234-someId-6789' },
- {$pull: { 'connections._id': '1234-someId-6789' }},
- function (err,val) {
- console.log(val)
- });
- userAccounts.update(
- { userId: usr.userId },
- { $pull: { connections : { _id : connId } } },
- { safe: true },
- function removeConnectionsCB(err, obj) {
- ...
- });
- var ObjectId = require('mongoose').Types.ObjectId;
- userAccounts.update({'connections._id': new ObjectId('1234-someId-6789') },
- {$pull: { 'connections._id': new ObjectId('1234-someId-6789') }},
- function (err,val) {
- console.log(val)
- });
- Customer.findOneAndUpdate(query, {$pull: {address: addressId}}, function(err, data){
- if(err) {
- return res.status(500).json({'error' : 'error in deleting address'});
- }
- res.json(data);
- });
- const removeTansactionFromUser = (userId, connectionId) => {
- return User.findByIdAndUpdate(userId, { $pull: { "connections": connectionId} }, {'new': true} );
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement