[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.)
[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: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: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: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
[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?
[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",
[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?