PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Thursday the 25th of May, 2017

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:51:09] <synapse> hello
[01:10:25] <joannac> hi synapse
[02:48:59] <janat08> im trying to aggregate flat schema from document subfield fields
[02:49:23] <janat08> $group: { _id: {$skills.<fields>}?
[03:29:46] <synapse> how are you joannac ?
[04:33:04] <janat08> how do i reffer to embeded document fields as a wholte list
[04:34:02] <janat08> so that I could group by fields containing source _ids
[09:59:31] <mylord> how can i patch only some fields and also keep history of those patches.. i’ve seen plugins for either operation, but not both
[10:01:06] <mylord> so for instagram example, say i don’t want to alter the iamge, but just the text, and keep a history of those text changes
[10:11:40] <mylord> oh, i guess this does it https://www.npmjs.com/package/mongoose-patch-history
[15:52:25] <ishanjain28> Hey!
[15:52:36] <ishanjain28> I had a question related to large scale database backups...
[15:53:32] <ishanjain28> I am working on a system that handle 5000 requests every second. The database is around 23 GB. It takes sometime to create a backup using mongodump.
[15:53:41] <ishanjain28> The server is written in go.
[16:41:47] <MacWinner> i'm trying to reproduce the most basic case of Socket timeout error on a connection using mongodb + nodejs (so that I can fiddle with the socket timeout settings to see how it actually works). We are seeing some socket timeout errors in the logs in production, but I can't reproduce them easily
[16:42:01] <MacWinner> any tips or pointers appreciated
[19:26:20] <fakingfantastic> I’m new to mongo, can someone explain to me when when I do {$text: {$search: “AR-1300”}}, I get results that don’t include that exact string in my indexed data?
[19:26:52] <fakingfantastic> But things that also in include “AR”, and “1300”, and “Axxxxx Rxxxxx"
[19:27:56] <fakingfantastic> I also get nothing under queryPlanner.terms when I use explain(true)
[19:28:04] <kexmex> try \- ?
[19:28:47] <kexmex> what are you trying to do btw, trying to use regexp?
[19:36:15] <fakingfantastic> kexmex: yeah, I tried escaping it - no difference. Im searching users: I made an index of each user’s full name and a unique ID. Just trying to search the user by that ID
[19:36:32] <kexmex> ok so you need an exact patch right
[19:36:34] <kexmex> match*
[19:36:37] <fakingfantastic> db.users.find({$text: {$search: "AR\-1300"}}, {score: {$meta: "textScore"}}).sort({score:{$meta:"textScore"}})
[19:36:39] <kexmex> what's the field name?
[19:37:00] <fakingfantastic> Core.Full Name
[19:37:06] <kexmex> umm
[19:37:11] <kexmex> AR-1300 is full name?
[19:37:18] <kexmex> or ID
[19:37:31] <fakingfantastic> ID
[19:37:36] <kexmex> oh, that's some full text index?
[19:37:38] <fakingfantastic> that field is, User_ID
[19:37:55] <kexmex> so why not do something like { user_id : "AR-1300" }
[19:38:10] <fakingfantastic> yeah, exactly I did… db.users.createIndex({‘Core.Full Name’: ‘text’}, {‘User_ID’: ‘text’}})
[19:38:23] <kexmex> that's index to speed it up
[19:38:35] <kexmex> if you are searching by User_ID, then you should have it first the index
[19:38:40] <fakingfantastic> I read you need to index to do full text search: https://code.tutsplus.com/tutorials/full-text-search-in-mongodb--cms-24835
[19:38:42] <kexmex> otherwise you'll always need a full name
[19:38:50] <kexmex> are you doing a full text search?
[19:39:08] <kexmex> what are you trying to do ? :)
[19:39:17] <kexmex> end result
[19:39:21] <fakingfantastic> The reason is, I’m making a search API endpoint, and I just want the user to be able to do /users/search?q=Some Name, or /users/search?q=AR-1300
[19:39:49] <kexmex> i don't think you need full text search here
[19:40:07] <kexmex> you are just trying to lookup a user by either name or id
[19:40:08] <kexmex> right
[19:40:12] <fakingfantastic> indeed
[19:40:16] <kexmex> ok so you need two indexes
[19:40:19] <kexmex> and you need to use $or
[19:40:28] <kexmex> this has nothing to do with full-text search
[19:40:51] <fakingfantastic> kinda felt like fts to me, but like I said.. im new :)
[19:41:04] <kexmex> fts is like when you wanna search for strings wtihin big blobs of text and shit
[19:41:12] <fakingfantastic> i feel you
[19:41:21] <kexmex> you wanna do something like
[19:41:30] <kexmex> where userId = <id> or name = <name>
[19:41:30] <kexmex> right
[19:41:39] <kexmex> so you want two indexes, one for userId and one for Name i think
[19:41:47] <kexmex> and then you wanna run an $or query
[19:41:49] <fakingfantastic> yeah, and each one of those can be subsets of the hit too
[19:42:02] <kexmex> subsets like partial patches?
[19:42:03] <kexmex> matches*
[19:42:19] <fakingfantastic> so like name = “Cha” … get’s me Charles, or Chaplin, or Chance
[19:42:27] <kexmex> what about
[19:42:34] <kexmex> in the middle of the string
[19:42:39] <fakingfantastic> sure
[19:42:42] <kexmex> well
[19:42:55] <kexmex> you can do something like { name : /arles/ }
[19:43:02] <kexmex> that's regexp
[19:43:08] <fakingfantastic> ahh… mongo and regex
[19:43:24] <kexmex> not sure what kinda index you need fro that though
[19:43:29] <fakingfantastic> I swear, I’m so used to MySQL that it’s actually limiting me from thinking NoSQL
[19:43:36] <kexmex> regular index would work for like
[19:43:47] <kexmex> name like 'Cha%'
[19:43:55] <kexmex> but prolly is no good for name like '%Cha%'
[19:44:21] <kexmex> so maybe you need $text :)
[19:45:21] <fakingfantastic> all good, i can start from here
[19:45:40] <fakingfantastic> when you said, “not sure what kinda index you need for that”… did you mean “regex?"
[19:45:58] <fakingfantastic> Or do I actually need an index if I’m using $or… cause it seems to be working fine
[19:46:27] <kexmex> well i thought you need exact match
[19:47:16] <fakingfantastic> db.users.find({$or: [{'Core.Full Name': /AR-130/}, {‘User_ID': /AR-130/}]})
[19:47:22] <fakingfantastic> That’s working spot on
[19:47:38] <kexmex> yea but as your DB grows i am not sure
[19:47:47] <kexmex> if it will perform :)
[19:48:15] <kexmex> u might wanna esape - is it part of regex?
[19:55:36] <fakingfantastic> - is a range operator, but I believe it need to be in square brackets
[19:55:52] <fakingfantastic> so like /Plan\s[A-Z]/
[23:41:05] <MacWinner> if my mongodb query .explain() results says "FETCH" in the winning plan, does that mean the query is not using indexes?
[23:48:30] <jeffreylevesque> what is the local database?
[23:50:58] <jeffreylevesque> ah nvm
[23:51:02] <jeffreylevesque> was just reading https://docs.mongodb.com/manual/reference/built-in-roles/#readWriteAnyDatabase
[23:51:13] <jeffreylevesque> so basically, if i creaate another database this would grant access to it
[23:51:20] <jeffreylevesque> but, local comes with base install
[23:51:30] <jeffreylevesque> and this role doesn't give permission to local
[23:58:00] <MacWinner> seems like the ordering in which i put query fields in my query object affects the mongodb winningPlan selection for query
[23:58:06] <MacWinner> is this expected?