PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Saturday the 11th of April, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[02:03:37] <luaboy> I use a unique int value to be _id ,but it still report duplicate key error ,what is the reason ?
[02:45:47] <GothAlice> luaboy: Two points: first, I hope you're not trying to simulate auto-increment numerical IDs. Second: you have a duplicate in some unique index, it might not be _id. Query for the _id you are trying to insert, if it exists, well there you go. (Look at the other fields, too.)
[02:54:08] <fullstack> hello
[03:11:33] <luaboy> GothAlice:I use the datetime as the _id , it could not same for each insert operation
[03:13:22] <preaction> in milliseconds? nanoseconds? i'm sure in either case it could be the same
[03:19:14] <Boomtime> luaboy: duplicate key error reports the index that collided, which in conjunction with the document you just tried to update/insert tells you the values of the collision
[03:20:48] <fullstack> How do I automatically query documents that have Manual References ids to other documents?
[03:21:00] <fullstack> instead of doing two (or more) queries and duplicating my code?
[03:21:53] <luaboy> Boomtime:do you mean it is values collided?
[03:23:47] <Boomtime> fullstack: do you mean a join? mongodb does not support automatic joins, if you have created relational data between collections, then you will need to do two queries
[03:24:01] <fullstack> Boomtime, I guess, I want DBRef
[03:24:58] <fullstack> whats the syntax for that, do I do { "$ref" : 'paernt_documentname , "$id" : 'parent_document_id'} but when do I want to use that syntax? on an insert?
[03:25:25] <preaction> you probably don't want DBRef
[03:25:44] <preaction> and DBRef are something you insert
[03:26:50] <fullstack> http://pastebin.com/F8QPKAqe I got an error on inserting
[03:27:24] <preaction> you still probably don't want DBRef
[03:28:04] <fullstack> but if I use Manual References I have to do a query for each subdoc
[03:28:06] <fullstack> right?
[03:28:26] <fullstack> and I don't want to do that. I want to do one query that grabs them all. Performance be damned.
[03:28:32] <preaction> if you use DBRef, you also still need to do another query
[03:29:08] <preaction> your dbref has an invalid field "subdoc"
[03:29:39] <Boomtime> http://docs.mongodb.org/manual/reference/database-references/
[03:29:58] <fullstack> document to insert can't have $ fields ?
[03:30:02] <Boomtime> it sounds like you know your choices and now it's just a matter of figuring out what works for you
[03:30:37] <fullstack> Yeah its funny that document page doesn't actually say that you have to insert it
[03:30:44] <fullstack> and when I do, I get an error?
[03:30:49] <preaction> because the "subdoc" field makes mongo think it's not a DBRef. you need to remove that field. or move the DBRef into something with a name, like { parent: { "$ref" : ... }, subdoc: "derp" }
[03:31:13] <fullstack> oh, I can do parent : { $ref .. ok interesting
[03:31:54] <Boomtime> fullstack: http://docs.mongodb.org/manual/reference/limits/#Restrictions-on-Field-Names
[03:34:02] <fullstack> is this it?
[03:34:10] <fullstack> db.fdsa.insert( { "ref" : "asdf", "id" : ObjectId("55289290af4f57d58fad0e86") } );
[03:34:22] <preaction> you need the $
[03:34:26] <preaction> also, did it work?
[03:34:40] <preaction> why would you insert a document that consists only of a dbref?
[03:34:53] <fullstack> to test it
[03:35:07] <preaction> but you didn't test it, you asked us instead
[03:35:25] <fullstack> I can't do $, remember? document to insert can't have $ fields
[03:35:38] <preaction> [22:30:09] <preaction> because the "subdoc" field makes mongo think it's not a DBRef. you need to remove that field. or move the DBRef into something with a name, like { parent: { "$ref" : ... }, subdoc: "derp" }
[03:37:41] <fullstack> db.fdsa.insert( {test: "asdf", asdf:[ {$ref:'asdf', $id: ObjectId("55289290af4f57d58fad0e86")}]}); this worked
[03:38:12] <fullstack> and this is what db.fdsa.find() showed FYI : { "_id" : ObjectId("552896faaf4f57d58fad0e8f"), "test" : "asdf", "asdf" : [ DBRef("asdf", ObjectId("55289290af4f57d58fad0e86")) ] }
[03:40:16] <fullstack> and I ahve to do a second query anyway :) heh
[03:40:32] <preaction> [22:27:53] <preaction> if you use DBRef, you also still need to do another query
[03:41:09] <fullstack> Yeah, I was just wondering if driver would pick that up. If you use parse.com, which is built on mongodb , it automatically queries
[03:41:36] <fullstack> Like maybe there is an node driver that would go "HEY thats dbref, lets do another query before returning results"
[03:41:53] <fullstack> Does anyone know?
[03:42:55] <fullstack> [1] Some community supported drivers may have alternate behavior and may resolve a DBRef into a document automatically.
[03:43:14] <fullstack> ^^^ thats a quote from the document... but which drivers are they? (thanks a lot mongodb docs.. for nothing! :)
[03:49:48] <Boomtime> fullstack: you suggest that mongodb should document the feature-set of all community code?
[03:51:25] <Boomtime> btw, there is a short list of some community drivers here: http://docs.mongodb.org/ecosystem/drivers/community-supported-drivers/
[03:52:06] <Boomtime> but documenting the precise feature support of even this subset i think would be an unreasonable request
[03:56:46] <fullstack> It was Mongoose that does it with the populate command
[03:59:37] <fullstack> looks like there is a npm package that does all of this for me so I don't have to worry
[03:59:47] <fullstack> anyway thanks for your guys help
[04:00:02] <fullstack> btw, check out rethinkdb.
[07:04:11] <mothergoose> Hi Everyone. I created an index using : db.users.createIndex({surname:"text", giveName:"text", roles:"text"}, {name:"nameAndRole_text"}); on a small (400 records) collection, but when I search using say db.users.find({$text:{$search:"michael"}}) - nothing comes up. What did I screw up? Thank you.
[07:16:41] <mothergoose> also - when trying simple indexes like - db.users.createIndex({giveName:"text"}, {name:"givenName_text"}); - still doesn’t work. Any ideas?
[08:01:24] <mothergoose> anyway to make fulltext searches of indexes support substrings?
[08:01:31] <mothergoose> any way*
[11:13:15] <pagios> whats the reverse of $addToset/
[11:13:53] <morenoh149> $push
[11:14:29] <pagios> morenoh149: REVERSE
[11:14:38] <pagios> like i want to remove an element of an array on a document
[11:14:59] <morenoh149> oops nvm http://docs.mongodb.org/manual/reference/operator/update-array/
[11:15:12] <morenoh149> $pull
[11:15:20] <pagios> tx
[11:43:56] <pagios> is it normal when i exit mongodb console to lose all data in my collection?
[12:49:54] <Sagar> HI
[12:50:06] <Sagar> i just migrated my server and got the dump from old server
[12:50:17] <Sagar> using mongodump and then restored using mongorestore
[12:50:34] <Sagar> but now i add new logins to the db in mongo and it doesnt work, what could be wrong?
[13:31:19] <kmtsun> hello everyone
[14:00:30] <Sagar> anyone
[14:56:50] <deranged> dpkg: error processing package mongodb-server (--configure):
[14:56:52] <deranged> subprocess installed post-installation script returned error exit status 1
[14:56:54] <deranged> debian unstable, any clues?
[14:57:21] <Sagar> anyone
[14:57:25] <Sagar> i am unable to add in my db
[15:01:59] <deranged> http://pastebin.com/GhsjQuyZ
[15:02:01] <deranged> full error
[15:02:11] <deranged> from, again, debian unstable
[15:17:25] <Sagar> anyone alive?
[19:25:37] <basichash> I get an error when trying to run db.items.find({$text: {$search: "string"}}):
[19:25:39] <basichash> "$err" : "Unable to execute query: error processing query: ns=react-tweets.tweets limit=0 skip=0\nTree: TEXT : query=OneDirection, language=, tag=NULL\nSort: {}\nProj: {}\n planner returned error: need exactly one text index for $text query",
[19:25:41] <basichash> "code" : 17007
[20:37:14] <morenoh149> basichash: is there a text index on your collection?
[20:37:16] <morenoh149> http://docs.mongodb.org/manual/reference/operator/query/text/
[20:37:46] <basichash> morenoh149: sorted it out, thanks
[20:42:03] <Kamuela> I'm having trouble with updating a colleection and I think it's the syntax
[20:42:09] <Kamuela> meaning mine is wrong
[20:43:24] <Kamuela> user.update({ $set: { profile: { creditBalance: credits } } }); does this change user.profile.creditBalance to credits or create user.profile.creditBalance if it doesn't already exist?
[20:56:13] <hemmi> Hey there. I am trying to figure out if mongo is right for my application. I have users who have sites and pages, but are pretty issolated; users don't care about other users or their sites and pages. Is this a good model for storing things as documents?
[20:57:45] <morenoh149> hemmi: sure
[22:46:38] <savantgarde> How do I install mongo client 3 on Ubuntu 14.04?
[22:50:36] <savantgarde> Nevermind