These are chat archives for Automattic/mongoose

Nov 2016
Nov 05 2016 01:19
The following is my code in App.js. I am using mongoose for communication with mongodb. I am using Mongoose aggregation.lookup for joining two tables and i am not able to get the collection of records. Can somebody tell me what is the problem?
var catProds = mongoose.model('SV_Catgeory_Products');
var prods = mongoose.model('SV_Products');
var obsr=catProds.aggregate([
from: "prods",
localField: "productId",
foreignField: "productId",
as: "inventory_docs"
The output of my code is as below
Aggregate {
_pipeline: [ { '$lookup': [Object] } ],
{ [Function: model]
hooks: Kareem { _pres: {}, _posts: {} },
Mongoose {
connections: [Object],
plugins: [],
models: [Object],
modelSchemas: [Object],
options: [Object] },
modelName: 'SV_Catgeory_Products',
model: [Function: model],
NativeConnection {
base: [Object],
collections: [Object],
models: [Object],
config: [Object],
replica: false,
hosts: null,
host: 'localhost',
port: 27017,
user: undefined,
pass: undefined,
name: 'satvik',
options: [Object],
otherDbs: [],
_readyState: 2,
_closeCalled: false,
_hasOpened: false,
_listening: false,
db: [Object],
_events: [Object],
_eventsCount: 1 },
discriminators: undefined,
Schema {
obj: [Object],
paths: [Object],
subpaths: {},
virtuals: [Object],
singleNestedPaths: {},
nested: {},
inherits: {},
callQueue: [Object],
_indexes: [],
methods: {},
statics: {},
tree: [Object],
_requiredpaths: undefined,
discriminatorMapping: undefined,
_indexedpaths: undefined,
query: {},
childSchemas: [],
s: [Object],
options: [Object],
'$globalPluginsApplied': true },
NativeCollection {
collection: null,
opts: [Object],
name: 'sv_catgeory_products',
collectionName: 'sv_catgeory_products',
conn: [Object],
queue: [],
buffer: true,
emitter: [Object] },
Query: { [Function] base: [Object] },
'$__insertMany': [Function],
insertMany: [Function] },
options: undefined }
Run code snippetCopy snippet to answer
can any body help me in this
Nov 05 2016 01:25
as per mongoose docs i have to get the collection of records which i am not able to
Nov 05 2016 05:24
any help will be appreciated
Guilherme Rizzo
Nov 05 2016 10:43
Hello people! Is there any way to "search"/match incomplete names with .populate()?
school.get('/:id/users/search/:name', (req, res) => {
    path: 'users',
    match: {
      name: //Just works if i have the full name 'Guilherme Rizzo', not 'Gui'