node.js - Mongoose Query Nested Data Multiple Word Key -
i cannot find example of how build query property name of nested property multiple words.
var student = { name: 'kevin', address: { 'street 1': '123 main', 'street 2': 'apt 2' city: 'chicago' }; // works. var query = student.find({ 'address.city': 'chicago' });
i cannot figure out how query street 1.
// tried this. did not work. var query = student.find({ 'address["street 1"]': '123 main' });
use same dot notation syntax, should work:
// tried this. works. var query = student.find({ 'address.street 1': '123 main' });
Comments
Post a Comment