-
-
Notifications
You must be signed in to change notification settings - Fork 237
Not Ok for storage #356
Comments
I don't know for sure if it is the problem, but given that that is client code, you will want to update Meteor.users in an |
Also, in some circumstances you can get this error with pre-2.6 MongoDB. See meteor/meteor#1890 |
Interesting. I'm wondering it it could be related to bson_ext. Genghisapp complains about it, it is installed, but I'm not really sure how to add it to my load path. Other then that I can't think of anything that could be problematic. |
Just a thought: did you |
@aldeed Good idea. I had made sure to add it, but it was not in my smart.json file. My meteor list --using is: Also, I tried referencing the git master branch of cfs-ejson-file, but no joy. |
Well, I tried switching from my local mongo instance to mongoHQ, but unfortunately I get
I did a meteor reset as wiped the cfs folder in .meteor/local, but still get the error. |
Personally I would store a reference to the record or the URL. If you store
|
@copleykj, it actually does not store a lot of data. The cfs-ejson-file pkg adds a custom EJSON type for FS.File so when you store one, it actually stores only a simple pointer and when you retrieve it later Meteor converts that pointer back into the full FS.File. |
oh, wow I did not know that.. That's pretty awesome! On Tue, Jul 8, 2014 at 8:35 PM, Eric Dobbertin notifications@github.com
|
So I think got to a better error message now.
I'm wondering if this is something new in Meteor 0.8.2. Also, I took a closer look at the fileObj that I'm trying to save. I don't know how it is not an ordinary JavaScript object, but I did notice there are closures in the controlledByDeps and attachData properties. |
So it's complaning about storing into the filerecord, should investigate further - maybe try rigging a filerecordClone function on that insert making sure it's pure data + investigate the change in meteor. The error message is new, "Error: Only documents (plain objects)..." |
@raix Thanks for the tips. |
So I tried @aldeed minimal sample. It outputs the same result in pre and post meteor update.
|
So I'm I correct that no one is successfully storing the ejson reference to a cfs file in their projects? Is everyone use the fileObj._id? |
I have successfully done it, but I think it might depend on what mongo operator you try to use or something. Like $push might work and not $set, or not within a sub object (ie, not when there's a dot). I don't remember the exact details and I'm not able to test it out right now. I also know that you can't insert an FS.File itself, as the full doc, but it does not seem like you are doing that, although that's what the error message sounds like. |
@aldeed Indeed, you are correct. I changed the code to using $push. I did add the ejson reference as a sub-document. Yippee! As for the insertion of full doc, I'm not to sure what you mean. I've tried the inserting the result of the callback form, e.g. Images.insert(fsFile, function(err, fileObj) {... and var fileObj = Images.insert(fsFile). The current version I have posted on github uses |
By inserting a full doc, I mean I guess we will have to figure out guidelines for storing ejson refs until the bugs are fixed and all operators are supported. |
I have Meteor 0.8.2 , I did add collectionFS , mrt add collectionFS , it is listed under mrt list which I have this code server/orientatin.js and the following code in client/orientation.js I did mrt update , same result , I appreciate your help Thanks Rania |
@raniafekry , see if this fixes it: $ meteor add collectionFS Use As long as it shows up when you do |
Thanks Eric , it works great with meteor not mrt I was able to have the delete and download button working , can I set Thanks Rania On Tue, Jul 29, 2014 at 12:02 PM, Eric Dobbertin notifications@github.com
|
Anyone knows why $push works and $set doesn't? |
I don't really understand why, but I think it's fixed by this commit, which isn't until mongo version 2.5.2. Meteor locally uses 2.4.9. Someone could try running against a DB running on 2.5.2+ to see if $set works. |
Hi @aldeed I am getting the same error when using Collection-FS. It works for new inserts (or create) but not for update. Any clue on how to fix this?
P.S. - I am trying to update the fileOBJ reference in the users collections after FileObj is created (insert(file)). |
@gauravtiwari just a wild guess.... maybe it has to be treated like queries? Meteor.users.update({_id: current_user}, { $set: { 'profile.coverphoto': fileObj } } ); |
@nooitaf Ralf, tried it but same result. |
@gauravtiwari, is that with Meteor's built-in mongo? I don't think there is any solution other than to wait until Meteor uses MongoDB 2.5.2+ by default or to connect to your own mongoDB instance that is on 2.5.2+. |
@aldeed Hi Eric, Yes it's the one built-in. Will it work with the local mongo instance - 2.6.3? I just tried connecting to my local instance using mongo_url but seems like a lot of functions from CFS-upload-http isn't working. $setoninsert (file upload functions). Thanks for looking into this. |
I seem to recall that there are a number of known issues running Meteor against 2.6+. Are you able to test against 2.5.2 instead? I will not have time to test this out for another week or so at least. |
My guess - it's a problem with ejson serializing, field names should not cointain $ sign: |
Ok, after digging around I come to this meteor/meteor#1890 it's definitely mongodb+ejson issue with $ in the middle of field names and not collectionfs problem, 2.5.2 should work. Argh, so annoying, I'm using Meteor Up for deployment and it installs stable 2.4 branch on server setup. |
This should be working now that Meteor is using 2.6 by default. |
I saw that @BraveKenny was successful in getting images stored and retrieved in "Best/Correct way to store images in public dirrectory and get their url in the callback?"
That's awesome!
Unfortunately, when I attempt to add the to the user's profile.profileImage I get
My fileObj look like the following. It has references to dataman and such in there. A bit more complex then I expected. I did make sure to add cfs-ejson-file
I made sure the user has a profile and profile.profileImage property.
I'm I missing something here?
Thanks
Marc
The text was updated successfully, but these errors were encountered: