Questions tagged [objectid]

The ID of an object. This is used, among other reasons, to refer back to the object at a later time in the program

Used especially in web programming where space on the stack is limited, objectids are used to refer to objects at different parts of the program, and possibly even across different user sessions, if some marshalling is implemented (as databases, etc).

The ID of an object can also be used to determine if two objects are distinct instances or are indeed the same object, in which case, any modifications made on one would be reflected in the other as well

481 questions
0
votes
1 answer

What should I put on the whereKey:@"objectId"?

I'm using iOS. If I insert @"objectId" in the whereKey:@"". I get an error saying: bad special key: objectId. This is my code: PFQuery *findFriends = [PFUser query]; [findFriends whereKey:@"objectId" equalTo:friendsID]; [findFriends…
John Boss
  • 3
  • 3
0
votes
1 answer

Check if Table Exists in external linked database

So I'm creating a script where I"m linking a database that is in another server. Using OBJECT_ID I want to check whether a table exists in the external linked database like so: IF OBJECT_ID('[10.0.48.139].[DBNAME].[dbo].tblRating', 'U') IS NOT NULL …
Eric Bergman
  • 1,453
  • 11
  • 46
  • 84
0
votes
1 answer

MongoDB fetch values of ObjectId Array

I am creating a simple application which will track every time a player kills another player. This means that when they kill a player, the killed player will be added to their userarray (containing all the players they have killed) which can then be…
Timothy Hanes
  • 297
  • 1
  • 5
  • 17
0
votes
1 answer

Schema.Types.ObjectId default value non null

Is it possible to have a default value in a mongoose schema for a field with Schema.Types.ObjectId type? My problem is simple: status: { type: Schema.Types.ObjectId, ref: 'type', category: 'languageStatus' }, I would like to use the…
Vadorequest
  • 16,593
  • 24
  • 118
  • 215
0
votes
1 answer

Spring data mongodb throws org.springframework.dao.DuplicateKeyException

I have an object that I want to save to both mysql and mongodb object class is like: Order: public long id; public String brokerID;//UUID public String userID;//UUID public String orderID;//UUID public double price; public long volume; the long id…
Li Tian Gong
  • 393
  • 1
  • 6
  • 16
0
votes
1 answer

How to generate mongdb objectid in django to insert a nested object with id

I am using mongoengine in django.I want to create a objectid which I can insert in nested object wholesalers of firm collection class wholesaler(EmbeddedDocument): wid = ObjectIdField() name = …
Praveen Singh Yadav
  • 1,831
  • 4
  • 20
  • 31
0
votes
2 answers

How to query against ObjectId when not in mongo shell

I'm working on paging functionality using a range query. I'm using this test query in the mongo shell: > var params = {$query: {_id: {$lt: ObjectId("52b06166eff887999c6efbd9")}}, $orderby: {_id: -1}, $maxScan: 3} > params { "$query" : { …
ytran
  • 120
  • 6
0
votes
0 answers

Getting Facebook Object ID using URL

There are a few different threads of this question but none seem to have a correct answer. Please can someone confirm what is happening with this, dated 26th November 2013. I have a number of og:urls. I would like to get the object_id of that…
Alex Chin
  • 1,642
  • 15
  • 28
0
votes
2 answers

How to create new Mongo ObjectId

I am trying to generate a new Mongo ObjectId object for future use: var objectId = new Mongoose.Schema.Types.ObjectId(); But keep getting: { "instance": "ObjectID", "validators": [], "setters": [], "getters": [], "_index": null } How can…
Edward Ruchevits
  • 6,411
  • 12
  • 51
  • 86
0
votes
2 answers

node-mongodb-native creates sequential object ids

Somehow mongod-native creates sequential object ids for inserted objects. I would prefer it if the database could do this job, or mongodb-native could at least use the same generation strategy as the db does. Inserting with mongodb-native…
thertweck
  • 1,120
  • 8
  • 24
0
votes
2 answers

mongodb custom objectId

I created an application using mongodb and never set an _id field and so am defaulting to mongo's objectId field. I cant generate an _id field now. Is there a way to customize how mongo generates the objectId for a specific collection? I want to…
user1175817
  • 449
  • 2
  • 7
  • 17
0
votes
1 answer

Do ObjectIds that reference Models have their own timestamp? (Mongoose v3.6.15)

Defined in the Blogpost model. schema.user = { type: mongoose.Types.ObjectId, ref: 'User' }; Later on when accessing a document matching the model... // Timestamp of when the user was created. userDocument._id.getTimestamp(); // Different…
aleclarson
  • 18,087
  • 14
  • 64
  • 91
0
votes
2 answers

how to find any document in database with an object id with mongoose?

I have some relational records in some collections. I use object ids for this. And I want to find an object with without collection find functions. Is it possible to use a global find function on db like…
Rephisto
  • 89
  • 1
  • 7
0
votes
0 answers

Mongoose schema change (with _id change)

I have a schema named card to update from {_id: ObjectId, id: String, ....} to {_id: String(same as id), id: String, ....} and update also a schema named users which is like {name: String, email: string, cards: {type: ObjectId, ref: 'card'}} how…
xDelph
  • 73
  • 7
0
votes
1 answer

MongoDB - Should I index tags with tag names or ObjectId?

As title, I am considering which key is better: tag names or ObjectId. Since tag names are unique, it OK to use them as index. What should I concern on choosing keys?
Trantor Liu
  • 8,770
  • 8
  • 44
  • 64