Parse-server: Querying _User via MongoDB directly.

Created on 7 Mar 2016  路  6Comments  路  Source: parse-community/parse-server

It seems like in Mongo, when I do:

> show collections;
_PushStatus
_Role
_SCHEMA
_Session
_User
...

I can see a bunch of collections. I seem to be able to query custom classes/collections fine, but when I try to query those _ classes, I get

> db._User.find().pretty()
2016-03-07T23:00:57.303+0800 E QUERY    [thread1] TypeError: db._User is undefined :
@(shell):1:1

Why is this?

Most helpful comment

This doesn't work for me.


rs-ds023438:PRIMARY> db["_User"].find()


2016-03-08T19:45:40.479+1100 E QUERY [thread1] TypeError: db._User is undefined :
@(shell):1:1

UPDATE: use db.getCollection("_User").find()

All 6 comments

try db["_User"].find()

Since the collections start with an underscore, it's necessary to access them as @flovilmart mentioned.

This doesn't work for me.


rs-ds023438:PRIMARY> db["_User"].find()


2016-03-08T19:45:40.479+1100 E QUERY [thread1] TypeError: db._User is undefined :
@(shell):1:1

UPDATE: use db.getCollection("_User").find()

db.getCollection("_User").find() is what works for me.

on a similar note, how can i edit al the acls manually via mongo db... i can see this:

"_acl" : { "*" : { "w" : true }, "LZpWH2ZPlD" : { "w" : true, "r" : true } },

and this
"_acl" : { "ZMs63uh7KE" : { "w" : true, "r" : true }, "*" : { "w" : true, "r" : true } }

and i know these methods:

`var bulk = db._USer.initializeUnorderedBulkOp();
bulk.find( { status: "D" } ).update( { $set: { status: "I", points: "0" } } );
bulk.find( { item: null } ).update( { $set: { item: "TBD" } } );
bulk.execute();

db.getCollection("_User").find()`

but i can't put it together to make all my users have Public Read and Write access programatically via the mongoDb console.

See mongodb documentation: https://docs.mongodb.com/manual/reference/method/db.collection.update/#update-specific-fields

providing the dot noted path should work: {$set: {"_acl.*": {"r": true}}}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ShawnBaek picture ShawnBaek  路  4Comments

ViolentCrumble picture ViolentCrumble  路  3Comments

dcdspace picture dcdspace  路  3Comments

shardul08 picture shardul08  路  3Comments

LtrDan picture LtrDan  路  4Comments