Open akolnati opened 7 years ago
Have you tried to use $push
update operator ?
ah!! Was about to try that but didnt know how do i form the query.
from referring to the below official example... how do i query tags.skill.third ( nested )
db.collection('people').findOne({ skills: { $in: ['html', 'javascript'] } }, updates).then(function(person) {
return db.collection('people').update(person, { $push: { skills: 'jquery' } });
}).then(function(updatesCount) {
// person has jquery skills now
});
i tried below
db.collection('people').findOne({ 'tags.skill.third': { $in: ['html', 'javascript'] } }, updates).then(function(person) {
return db.collection('people').update(person, { $push: { skills: 'jquery' } });
}).then(function(updatesCount) {
// person has jquery skills now
});
but all i get is undefined
Undefined at which line?
sorry for the confusion..what i meant was i tried a similar query to test the nested objects and that results in undefined.
for below sample object from people store
{
name : 'John',
age : 33,
tags : {
skill: {
first: '.NET',
second: 'JAVA',
}
}
}
if i execute the following simple query i get undefined for people[0] meaning the array is empty
db.collection('people').find({'tags.skill.first': { $in : ['.NET']}}).toArray()
.then((people) => {
console.log(people); // eslint-disable-line
});
below query works
db.collection('people').find({'name': { $in : ['John']}}).toArray()
.then((people) => {
console.log(people); // eslint-disable-line
});
Writing the statement like 'tags.skill.first' is supported?
Writing the statement like 'tags.skill.first' is supported?
No
Hi Yury, Thanks for the swift updates...Any plans to add such a feature in near future? or a work around that might suffice.. using this addon was such fun so far. Thanks
I'll try to come up with something, but no promises.
Brilliant...Thanks
Hey @OpsSingular, I started work on it. Branch dot-props
, nothing works tho. Just FYI
I am trying to add an object to an existing array which in inside a nested object. The structure looks similar to below
I have tried many way to push object special3:'run' to skill.third but without success. My last attempt looked something like this
The object is added outside and not inside the array 'third' something like below
I wish to know if there a way to add to arrays in nested object using dexie-mongoify? Help is appreciated.